Skip to content

Commit

Permalink
Move GA script to head.html (alshedivat#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
zt-chen authored Nov 30, 2020
1 parent 4c87463 commit fd5ef30
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
12 changes: 12 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,15 @@
{% if site.enable_darkmode %}
<script src="{{ '/assets/js/theme.js' | relative_url }}"></script>
{% endif %}

{% if site.enable_google_analytics %}
<!-- Global site tag (gtag.js) - Google Analytics -->
<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 %}
11 changes: 0 additions & 11 deletions _includes/scripts/misc.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@
</script>
{% endif %}

{% if site.enable_google_analytics %}
<!-- Global site tag (gtag.js) - Google Analytics -->
<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 %}

<!-- Load Common JS -->
<script src="{{ '/assets/js/common.js' | relative_url }}"></script>
Expand Down

0 comments on commit fd5ef30

Please sign in to comment.