Google Analytics
authorM. Taylor Saotome-Westlake <ultimatelyuntruethought@gmail.com>
Sat, 10 Jun 2017 02:55:30 +0000 (19:55 -0700)
committerM. Taylor Saotome-Westlake <ultimatelyuntruethought@gmail.com>
Sat, 10 Jun 2017 02:55:30 +0000 (19:55 -0700)
I had procrastinated on setting this up because I thought it would be
more wholesomely educational to learn to use a less-magical tool to
analyze the Nginx logs, rather than outsourcing this task (like
increasingly the rest of the world) to Google.

But finding out who likes me and hates me is more important than
wholesome log-analysis education!

The Google-Analytics JavaScript fragment that came with the theme looks
old compared to the one I got from the setup dashboard?

publishconf.py
theme/templates/base.html

index 6ed4609..738f1f3 100644 (file)
@@ -20,7 +20,4 @@ CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'
 
 DELETE_OUTPUT_DIRECTORY = True
 
-# Following items are often useful when publishing
-
-#DISQUS_SITENAME = ""
-#GOOGLE_ANALYTICS = ""
+GOOGLE_ANALYTICS = "UA-100822263-1"
index 9722dcb..fd8f60f 100644 (file)
        </div>
 
        {% if GOOGLE_ANALYTICS %}
-         <script>
-               var _gaq=[['_setAccount','{{ GOOGLE_ANALYTICS }}'],['_trackPageview']];
-               (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
-               g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
-               s.parentNode.insertBefore(g,s)}(document,'script'));
-         </script>
-    {% endif %}
+          <script>
+           (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+               (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+                                    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+           })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
+
+           ga('create', '{{ GOOGLE_ANALYTICS }}', 'auto');
+           ga('send', 'pageview');
+          </script>
+        {% endif %}
 
 </body>
 </html>