Fun Stuff
So I finally got around to adding a comments section via Disqus, and Google Analytics to this blog.
Disqus was a breeze.
I had no trouble hooking up Disqus. All I had to do was create an account and paste their JavaScript code into my _includes/disqus.html
file which I then embedded using {% include disqus.html %}
in my _layouts/default.html
. I copied the comment toggle idea from this guy, so I could use comments: True
in the YAML post header. To cover all my bases I configured the Disqus JS variables to help keep everything in tip-top shape:
disqus_identifier
: identifies the current pagedisqus_url
: tells Disqus which comment thread to pull up
Google Analytics was slick, but perplexing.
I signed in/up with my Google account and copied the JS tracking code into _includes/ga.html
. Following GA best practices, I put {% include ga.html %}
right above my </head>
tag in _includes/head.html
. This allows for more potential beacons to be emitted to GA before a user leaves a page.
The one confusing thing—I posit is due to caching—was in the GA Tracking Info→Tracking Code section. Next to the Tracking ID section there is a “Status” field stating Tracking Not Installed. This field includes a “Last checked” line with a corresponding date too, which updates relatively frequently. I had confirmed that the GA code was correctly loaded into <head>
both locally and on gh-pages so this was disconcerting. Network activity through Chrome’s DevTools said every resource was 200 OK
, but there still was no real-time or audience traffic appearing in the GA “Reporting” tab.
After some more browser voodoo (i.e. doing the cache-refresh rain dance) I eventually saw some activity in the real-time section. This meant the code was working. I was still curious about the audience section so I hit up Google Search which led me to this Stack Overflow post.
I love it.