For anyone using Jekyll’s Minima theme this post describes how I resolved an issue with outdated Google Analytics integration and maybe saving you some frustration. I’m embarrassed by how long it took me to fix but learned a lot along the way.

The Problem

The _includes/google-analytics.html file in the Minima theme uses an old Universal Analytics script, which no longer works for GA4 tracking IDs. It took me a while to figure out the problem first trying using the minima theme remotely as someone suggested somewhere.

This post by Sergey Gretchin pointed to the problem of the outdated minima code at Jekyll/minima/_includes/google-analytics.html. You’ve got to make your own _includes/google-analytics.html file with either the script strait from Google Analytics or with a reference using Liquid to {{ site.google_analytics }}.

Hours Wasted on Underscore vs. Hyphen Confusion

You’d think that it would be pretty easy to put google_analytics: G-[YOUR GOOGLE ANALYTICS CODE] into your _config.yml file. That’s what I thought I did but Google Analytics still didn’t work. Only after hours of blood, sweat and tears did I realize that I had put google-analytics in my _config.yml file echoing the google-analytics.html file name.

Unger’s First Open Source Contribution Gets Rejected

Problem solved I figured that maybe I could help other folks and save them some time by updating the code in the Jekyll minima theme google-analytics.html file. I forked. I pulled. I made the change. I added a nice description. I pushed my code up to GitHub. For a few seconds I was so proud of myself seeing my spanking new pull request up there with the other 20+ PR’s. Reading down the list I soon noted that 2 other people had already submitted the same solution. D’oh!

Note to Self: Check the Issues. Check the Existing Pull Requests

Being as new and inexperienced as I am I’ve historically found the Issues and Pull Requests on GitHub to be too complex for me to follow and understand. I now see that they can include solutions to problems that I’m struggling with. And there’s no need to offer the same solution that someone else already has. It took only 3 minutes for my PR rejection as redundant. All interesting and fun, though.