Cloudflare Analytics

Anyone who knows me, reads the type of things I tweet about, and/or listens to the Same Shade of Difference podcast knows that I’m an advocate of online privacy. I’m all for blocking trackers, avoiding services from invasive companies like Facebook, and generally trying to keep as much of what I do online known only to me. That being said, while I typically configure my browser to block things like Google Analytics because Google is already a super creepy company that gathers an order of magnitude more data than it should about people, I also see the value in having analytics for a website. It’s often helpful to see things like which content in particular is the most popular; if I know the types of content people like to see, then I can try to tailor what I write about to meet that need. Similarly it’s honestly just cool to be able to see when my site gets traffic from people all across the globe. Seeing that someone on the other side of the planet found my content useful or interesting is just neat. As a result, I’ve been on the lookout for an analytics options that isn’t stalker-esque like what Google offers.

One of the initial options I considered was Plausible Analytics. They have a presence on the Fediverse, which is how I first became aware of the company. Their offering is appealing because it provides metrics to website owners without collecting personal data on the visitors, which is exactly what I’ve been wanting. Unfortunately for me, there’s no free option for Plausible, and while paying $4 a month for a year if you get 10,000 hits or less per month — a threshold I’m well under — makes sense for a business or someone with a serious website, I didn’t feel like spending $48 USD per year just to get some neat metrics was worth it for me. I’m currently averaging around 1000 visits per month, so it’s not exactly as though I’m driving a business based around these analytics.

With all of this in mind, the announcement of Cloudflare’s privacy-focused analytics immediately piqued my interest. Understandably, many people in technology circles have reservations about Cloudflare. Cloudflare serves as the gatekeeper to so much of the Internet’s traffic that when they have an outage, sometimes it feels as though the entire Internet is down; that’s not exactly an ideal situation for a healthy and robust Internet ecosystem. When Cloudflare’s analytics platform originally launched, I was dismissive of it because it was only an option for those hosting their content behind Cloudflare. If I needed DDoS protection or a CDN then I might consider something like putting my site behind Cloudflare, but without that I’m more than a little loathe to start transferring my DNS records.

Right around the end of 2020, though, I saw that Cloudflare’s analytics were now open to be used by anyone regardless of hosting. Curious, I logged into my existing Cloudflare account that I created back in the day when using Cloudflare was the only option for configuring GitHub Pages with an SSL certificate. Sure enough, “Web Analytics” was an option within my Cloudflare Dashboard. All I had to do was provide the address for my site, and Cloudflare gave me a snippet of JavaScript to add for the analytics.

Given that my site is now hosted on WordPress, I couldn’t directly add content to the header or footer section of my HTML. After a quick DuckDuckGo search, though, I found some recommendations for the Insert Headers and Footers plugin. The plugin adds a tab to the Settings section of the WordPress Dashboard with fields for, you guessed it, the header and the footer. Any content that I place in there is automatically added to the header and/or footer of each page that WordPress renders. I simply pasted the snippet of JavaScript from Cloudflare into the footer section, and everything was up and running for me.

Similar to Plausible, CloudFlare’s analytics platform gives me some basic details without anything particularly creepy about the people visiting my site. I see things like the country they’re from (nothing more specific than that), the browser, the operating system, the referrer (e.g. if someone is clicking a link to my site from Twitter or DuckDuckGo), and which page was viewed. The last part is the one that allows me to stay on top of what content people are finding the most useful. For example, since implementing Cloudflare analytics, I’ve been able to see that my post on how to resolve issues installing Python packages through pip3 on macOS Big Sur has consistently been the most viewed. Behind that is my post on how to create a JWT in Groovy; that’s super useful since I had no idea if anyone else would even care about Groovy-related content.

The only thing that was immediately disappointing to me was that I could only add a single site; after adding Unusually Pink, there wasn’t an option to add another site along with that. A little over a week ago, though, when I went to my Cloudflare dashboard to see how my traffic looked from the previous night, I noticed a new UI that included an option for additional sites. I quickly added several other sites to start keeping tabs on them as well. This is surprisingly helpful for me because it enables me to see that several sites I maintain get literally no traffic. Those are sites that I’ll probably be taking offline and letting the domains expire since there’s clearly not much of a point in keeping them around if having them online for their own sake isn’t important to me (spoiler alert: it’s not.)

The only other thing worth mentioning is that, as is the case with any analytics platform, Cloudflare won’t provide a completely accurate picture of who visits your site simply based on how each user configures their browser. For example, I noticed that the tracking blocker built into current versions of Safari plays nicely with Cloudflare. However, I confirmed that Brave, the Chromium-based browser I use when I’m absolutely forced to use a Chromium-based browser, and uBlock Origin will still block the JavaScript element. As is always the case, your mileage may vary. Even without a 100% complete picture, though, I still like the insight that I glean from Cloudflare anaytics, and I don’t feel like I’m being abusive with the personal information for anyone visiting the site. With that being said, anyone who simply hates Cloudflare or disagrees with my assessment on just how private their analytics are can easily block them just as they can with every other analytics platform, which hopefully provides a happy medium.