Added async version of Google Analytics internal template
authorWade Fitzpatrick <wade@waddles.org>
Thu, 17 Dec 2015 05:56:16 +0000 (15:56 +1000)
committerSteve Francia <steve.francia@gmail.com>
Mon, 4 Jan 2016 15:33:18 +0000 (10:33 -0500)
tpl/template_embedded.go

index b54f92e7eb447e9a26a49c24e1752fd6191964fe..a2fde4b10705eefc5498027b0daaf9651e83a7f8 100644 (file)
@@ -232,5 +232,14 @@ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
 ga('create', '{{ . }}', 'auto');
 ga('send', 'pageview');
 </script>
+{{ end }}`)
+
+       t.AddInternalTemplate("", "google_analytics_async.html", `{{ with .Site.GoogleAnalytics }}
+<script>
+window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
+ga('create', '{{ . }}', 'auto');
+ga('send', 'pageview');
+</script>
+<script async src='//www.google-analytics.com/analytics.js'></script>
 {{ end }}`)
 }