Adding Google Analytics to Github.io Page with Jekyll
I recently installed Google Analytics on my Github.io Page with Jekyll, and I'm so glad I took the time to understand the Liquid system and what was going on underneath. After a few moments of research, I was able to successfully install Google Analytics and now I'm ready to move on to the next step. Read my blog post to find out how I did it!
Successfully Installing Google Analytics on my Github.io Page with Jekyll
By Michael Levin
Friday, August 20, 2021
Hello World… again! This is an exercise in commitment and consistency. I have a number of small touches to do here. Let’s fix the .vimrc! Okay, that should do it for a start. See how it autowrapped. That’s a “hard” line return at 79 characters. Many people… oh I digress. Let’s get onto to Google Analytics on a Github.io Page site. 1, 2, 3… 1?
Templates! Now I know a bit more about what’s going on in the examples I copy/pasted from. It’s all Jekyll Liquid templating language. Actually Liquid is from Shopify and Jekyll simply uses it… It’s just another curly braces template language like Django’s Jinja templates. It’s all basically the same with different nuanced rules. But nuances are all very important and I hate it when I have another thing like this to learn. Knocks something else out of my head. Keep tech liability low! That’s what we’re really doing with the Github Pages system for publishing vs. say WordPress… ugh!
Okay… No Google Analytics on MikeAtEleven.com, but on MikeLevinSEO.com…
Hmmm. Gotta even make sure I have it installed right on mikelevinseo.com, which I only did recently. I thought those two codes would be the same…
Let’s look at Google Analytics site… so you get to see me fix a mistake on the site I was trying to copy the example from. It was only a few days. Anyhoo, I get that same piece of code now but for a new site. Have to add it to GA…
So there’s the “before”. Let’s push our commits and get the “after”
It’ll take a few moments. I’ll organize the tabs… I still have to do some SEO. And the next video is going to be REALLY COOL with Jupyter Notebooks.
Okay, that’s it. That was the point of this video. I now have GA installed on MikeAtEleven.com. Very basic. All default settings. But I can always tweak later. This satisfies the 80/20-rule!
And you see a “template” from the Liquid system under Jekyll under Github Pages.
So you see how the YouTube embed made me dive deeper into something that I was originally just using copy/paste examples and verbatim instructions? It’s great to get started and learn “form” but you really have to understand more of what’s going on underneath.
Thanks, and later gators!