shithub: hugo

Download patch

ref: ff28120e53c7d3d5fce9941082f72eb89adb43b7
parent: 8f6f13104e0a3a8e7bdb8ec4de4d8a2af7e1048d
author: Wade Fitzpatrick <[email protected]>
date: Thu Dec 17 10:56:16 EST 2015

Added async version of Google Analytics internal template

--- a/tpl/template_embedded.go
+++ b/tpl/template_embedded.go
@@ -233,4 +233,13 @@
 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 }}`)
 }