These are my notes to remind future me how I did this because it was a bit unconventional. I found myself stuck in a hotel room for a few days with a laptop that could not connect to the server of my blog. There’s a few projects I’ve been meaning to get around to. One of them was to fix Google Analytics which has been broken ever since I restarted this blog. The limitation though is, I need to do this in a browser only.
Step 1: On the analytics page click the Admin gear icon in the lower left -> Data Collection and Modification -> Data streams -> Add Stream (or select existing stream if you have one)
Step 2: Get the script snippet. In the newly created data stream, click the button View Tag Instructions. There are two tabs, click the one labelled Install Manually. Copy the code snippet: Google tag (gtag.js)
Step 3: Install WPCode plugin: Plugins -> Install Plugins -> Search -> WPCode. Be sure to Activate after installing.
Step 4: Insert snippet into header. In the left nav click Code Snippets -> Header & Footer
Step 5: Paste the code snippet from Step 2 into the Header and Save Changes
Step 6: View source of any page and verify the code snippet exists.
Step 7: Verify Realtime data. Go to Google Analytics -> Reports -> Realtime Overview. You should see at least one user.
Important information for future me
The code snippet is in the header, not the more common location in functions.php
More important information for future me
The kind of person who would read this blog is also the kind of person who would run uBlock and tracking protection. The data gathered this way is probably an undercount. Thus, we are establishing a baseline here. In the future we’ll install something that counts traffic locally such as Plausible Analytics. But let’s be super honest here. The kind of person who actually reads this blog is the kind of person who is just me.