Skip to content

Commit

Permalink
fix: enable google analytics in production
Browse files Browse the repository at this point in the history
  • Loading branch information
ecshreve committed Aug 22, 2024
1 parent 63476d9 commit 9f73b16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# in the templates via {{ site.myvariable }}.

title: shreve.dev
environment: development
environment: production # !FIX! i think this is a no-op, controlled by JEKYLL_ENV variable

author:
name: Eric Shreve
Expand Down
9 changes: 9 additions & 0 deletions _includes/google-analytics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
<script>
window['ga-disable-{{ site.google_analytics }}'] = window.doNotTrack === "1" || navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1";
window.dataLayer = window.dataLayer || [];
function gtag(){window.dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', '{{ site.google_analytics }}');
</script>

0 comments on commit 9f73b16

Please sign in to comment.