Skip to content

Commit

Permalink
feat: use google analytics gtag script
Browse files Browse the repository at this point in the history
  • Loading branch information
sparanoid committed Nov 24, 2017
1 parent 4e4d067 commit c8ef051
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions _app/_includes/amsf/google_analytics
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
{% endcomment %}
{% capture amsf_google_analytics %}
{% if site.google_analytics.enabled %}
<script async src="{{ site.google_analytics.url }}?id={{ site.google_analytics.id }}"></script>
<script>
(function(a,m,s,f,j,k,l){a['GoogleAnalyticsObject']=j;a[j]=a[j]||function(){
(a[j].q=a[j].q||[]).push(arguments)},a[j].l=1*new Date();k=m.createElement(s),
l=m.getElementsByTagName(s)[0];k.async=1;k.src=f;l.parentNode.insertBefore(k,l)
})(window,document,'script','{{ site.google_analytics.url }}','ga');

ga('create', '{{ site.google_analytics.id }}', 'auto');
ga('send', 'pageview');
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ site.google_analytics.id }}');
</script>
{% endif %}
{% endcapture %}
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ service_worker:
google_analytics:
enabled: false
id: UA-xxxxxxx
url: //www.google-analytics.com/analytics.js
url: https://www.googletagmanager.com/gtag/js

# Site Twitter account handle
twitter: sparanoid
Expand Down

0 comments on commit c8ef051

Please sign in to comment.