diff options
author | Karl Hallsby <karl@hallsby.com> | 2021-06-18 23:02:21 -0500 |
---|---|---|
committer | Karl Hallsby <karl@hallsby.com> | 2021-06-18 23:02:21 -0500 |
commit | 3d6b437ebfb1c8c5e8f1beec215fb9e824adfad9 (patch) | |
tree | efa54734609075eaeff9d652b0b7404d4839b363 /_includes | |
parent | 7bf1363025ee6a042c7916abe90bf7dc36b3561a (diff) |
Add google analytics to siteadd-google-analytics
Diffstat (limited to '_includes')
-rw-r--r-- | _includes/head/custom.html | 11 |
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 --> |