Use new Google Analytics gtag.js
This commit is contained in:
parent
b5280175f0
commit
8de768dfb0
|
@ -102,7 +102,14 @@
|
|||
{% endif %}
|
||||
|
||||
{%comment%}<!-- google analytics -->{%endcomment%}
|
||||
{% if site.data.google_analytics.enabled %}<script>if(~location.hostname.indexOf("{{site.data.google_analytics.hostname}}")){var _gaq=_gaq||[];_gaq.push(["_setAccount","{{ site.data.google_analytics.id }}"]);_gaq.push(["_trackPageview"]);(function(){var ga=document.createElement("script");ga.async=true;ga.src=("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(ga,s)})()}</script>{% endif %}
|
||||
{% 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 }}')
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
<meta content='IE=edge' http-equiv='X-UA-Compatible'>
|
||||
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
|
||||
|
|
Loading…
Reference in New Issue