summaryrefslogtreecommitdiff
path: root/_includes
diff options
context:
space:
mode:
authorKarl Hallsby <karl@hallsby.com>2021-06-18 23:02:21 -0500
committerKarl Hallsby <karl@hallsby.com>2021-06-18 23:02:21 -0500
commit3d6b437ebfb1c8c5e8f1beec215fb9e824adfad9 (patch)
treeefa54734609075eaeff9d652b0b7404d4839b363 /_includes
parent7bf1363025ee6a042c7916abe90bf7dc36b3561a (diff)
Add google analytics to siteadd-google-analytics
Diffstat (limited to '_includes')
-rw-r--r--_includes/head/custom.html11
1 files changed, 11 insertions, 0 deletions
diff --git a/_includes/head/custom.html b/_includes/head/custom.html
index 33b1508..def324f 100644
--- a/_includes/head/custom.html
+++ b/_includes/head/custom.html
@@ -1,3 +1,14 @@
<!-- start custom head snippets -->
+{% if site.google_analytics and jekyll.environment == 'production' %}
+ <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
+ <script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag(){dataLayer.push(arguments);}
+ gtag('js', new Date());
+
+ gtag('config', '{{ site.google_analytics }}');
+ </script>
+{%- endif -%}
+
<!-- end custom head snippets -->