github.com/neohugo/neohugo@v0.123.8/tpl/tplimpl/embedded/templates/google_analytics_async.html (about) 1 {{ warnf "_internal/google_analytics_async.html is no longer supported by Google and will be removed in a future version of Hugo" }} 2 {{- $pc := .Site.Config.Privacy.GoogleAnalytics -}} 3 {{- if not $pc.Disable -}} 4 {{ with .Site.Config.Services.GoogleAnalytics.ID }} 5 <script> 6 {{ template "__ga_js_set_doNotTrack" $ }} 7 if (!doNotTrack) { 8 window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date; 9 {{- if $pc.UseSessionStorage }} 10 if (window.sessionStorage) { 11 var GA_SESSION_STORAGE_KEY = 'ga:clientId'; 12 ga('create', '{{ . }}', { 13 'storage': 'none', 14 'clientId': sessionStorage.getItem(GA_SESSION_STORAGE_KEY) 15 }); 16 ga(function(tracker) { 17 sessionStorage.setItem(GA_SESSION_STORAGE_KEY, tracker.get('clientId')); 18 }); 19 } 20 {{ else }} 21 ga('create', '{{ . }}', 'auto'); 22 {{ end -}} 23 {{ if $pc.AnonymizeIP }}ga('set', 'anonymizeIp', true);{{ end }} 24 ga('send', 'pageview'); 25 } 26 </script> 27 <script async src='https://www.google-analytics.com/analytics.js'></script> 28 {{ end }} 29 {{- end -}}