Update analytics snip

This commit is contained in:
Rico Sta. Cruz 2017-09-24 03:37:15 +08:00
parent c2d63daae2
commit 0b07b168c8
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
1 changed files with 5 additions and 3 deletions

View File

@ -105,9 +105,11 @@
{% if site.data.google_analytics.enabled %}
<script async src='https://www.googletagmanager.com/gtag/js?id={{ site.data.google_analytics.id }}'></script>
<script>
if(~location.hostname.indexOf('{{site.data.google_analytics.hostname}}')){
window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)};gtag('js',new Date());gtag('config','{{ site.data.google_analytics.id }}')
}
{% comment %}if(~location.hostname.indexOf('{{site.data.google_analytics.hostname}}')){{% endcomment %}
window.dataLayer=window.dataLayer||[];
function gtag(){dataLayer.push(arguments)};
gtag('js',new Date());
gtag('config','{{ site.data.google_analytics.id }}');
</script>
{% endif %}