diff options
Diffstat (limited to 'pelican-bootstrap3/templates/includes/ga.html')
-rw-r--r-- | pelican-bootstrap3/templates/includes/ga.html | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/pelican-bootstrap3/templates/includes/ga.html b/pelican-bootstrap3/templates/includes/ga.html index 8663e73..c0c3425 100644 --- a/pelican-bootstrap3/templates/includes/ga.html +++ b/pelican-bootstrap3/templates/includes/ga.html @@ -1,21 +1,21 @@ {% if GOOGLE_ANALYTICS %} <!-- Google Analytics --> - <script type="text/javascript"> - - var _gaq = _gaq || []; - _gaq.push(['_setAccount', '{{ GOOGLE_ANALYTICS }}']); - _gaq.push(['_trackPageview']); + <script async src="https://www.googletagmanager.com/gtag/js?id={{ GOOGLE_ANALYTICS }}"></script> + <script> + window.dataLayer = window.dataLayer || []; + function gtag(){dataLayer.push(arguments);} + gtag('js', new Date()); - (function () { - var ga = document.createElement('script'); - ga.type = 'text/javascript'; - 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); - })(); + gtag('config', {{ GOOGLE_ANALYTICS }}); </script> <!-- End Google Analytics Code --> + <!-- Google Tag Manager --> + <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= + 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); + })(window,document,'script','dataLayer','{{ GA_GTM_CONTAINER_ID }}');</script> + <!-- End Google Tag Manager --> {% endif %} {% if GOOGLE_ANALYTICS_UNIVERSAL %} <!-- Google Analytics Universal --> |