How-to insert a privacy-friendly alternative to Google Analytics on ANY website-builder (#tech)

CDNs like Cloudflare can inject privacy-friendly analytics code, even on GoDaddy Websites!

How it should work: inserting HTML code

Inserting privacy-friendly analytics code is easy. My fave is SimpleAnalytics - but this applies to similar competitors like Plausible & Fathom too - you just need to paste 2 lines of HTML somewhere on the website. Don’t worry that the 1st line is a script tag means that it’s Javascript running, and the 2nd line covers the 1% of Javascript-disabled web-users, just copy and paste the thing as HTML.

Modern Website Builders like Squarespace or Webflow are so common SimpleAnalytics has bespoke guides for them. Otherwise you have to just be creative at finding how to embed HTML. On Carrd, this is as simple as Embed block, and choosing Inline rather than Visible. With it’s knowing the hack that all Markdown recognises HTML, so you can just stick it in the Footer.

When it doesn’t work: restrictive website-builders like GoDaddy

But what if you aren’t on a really restrictive platform and can’t add custom-code? This is usually the case with free products, but it is also a case with one of the biggest beginner paid website-builders: GoDaddy. Believe me I’ve tried everything and my complaint to the company was met with deaf ears.
I suspect this might also be the case with some recently hacked-together simple landing-page builders like LinkTree, Mailchimp too.

Since May ‘21, I was faced with a difficult decision:
a) keep using the Google Analytics service provided, which means knowingly burdening my users with a cookie (and a cookie banner to be GDPR compliant) that will make it even easier for a surveillance capitalism company to track them
b) accept not having a good idea of website traffic.

I opted for option b, and went through the following phases:
i) rely on GoDaddy’s own analytics tool (which it claims is cookie-free) to gain an approx gauge of monthly visits, until I realised they were wildly changing retrospectively
ii) use Cloudflare’s free Web Analytics which only takes a 10% sample which is wildly inaccurate for small websites. I Proxy my traffic through the Cloudflare CDN because it is Free and am not considering upgrading to their business-priced plans ($20/mo+) anytime soon.
iii) fly blind. It does make me less motivated to write News posts when I can’t know whether 5 or 500 people visit them, especially with some of the potentially viral ones I have coming.

Turns out there was no trade-off all along. If GoDaddy won’t let me inejct code, someone else will after them. Here’s how to do it:

How to inject analytics script on any website using a CDN like Cloudflare

Firstly you need to be using a Custom Domain. Owning your analytics is one of the key reasons to own a domain. Otherwise the data belongs to the website-builder and you’re reliant on them and can’t implement workarounds like this! (Check my university to help select a dope one).
Secondly, point your proxy your domain through the CDN. In the case of Cloudflare, that means using their NameServers like and then logging onto their website and setting the A Records to Proxy 🟧☁️ (so Cloudflare can do advanced things like adding extra code when delivering the GoDaddy code) rather than DNS Only ⬜️ (just acting as DNS which is a glorified phone-book passing on the address GoDaddy’s code lives at).

Option A: use Cloudflare App (like SimpleAnalytics)

Recently, Adriaan has made the website onboarding amazing, with prompt to tell him your website tool. I had never bothered clicking Show more knowing GoDaddy wouldn’t be there, but I recently noticed Cloudflare was there and followed very clear instructions, you can also find on their own help page here.

Quick plug for SimpleAnalytics: Adriaan is amazing at taking feedback, and I pay a decent $9/month because of his dedication to improving his product.
You can get a free month if you use my referral link (and follow his uniquely transparent cookie-setting process!).

Option B: try Cloudflare Zaraz

Presumably this should work for other privacy-friendly analytics, not to mention any other scripts you wanna inject, which don’t have a Cloudflare App.
I actually thought of this first before checking if Adriaan had indeed written about Cloudflare. So I have still not yet tested it, but here is what I think you would do: click the Zaraz tab at bottom left on Cloudflare, and choose the Custom HTML block:

Then paste the code in there (I mean it even explicitly says it can run Scripts!)

Will update if anyone reaches out saying it works! There is probably a similar approach using less user-friendly CDN competitors like Fastly and Amazon CloudFront.

Option CBA: hire me to implement this for you

This is just one way I can make your website Moderner!

Appendix A: the limits of Privacy

Sweet, so now my listeners are free from Google. Oh no wait, YouTube:

Oh and also search-indexing - which now includes other video.

Yup, as usual with privacy, it’s impossible to be a perfectionist. But if you can easily make it 80% harder for people’s privacy to be stripped in 20mins, then do it.

As for Cloudflare, are they that much more trustworthy/privacy-friendly than Google? It’s a good time to be asking, given that they’ve just freely released Turnstile, an alternative to Google captcha. It’s possible that their freemium model will lead them towards surveillance models via their free products, so unless you have a specific Proxy use-case like this / Page (forwarding) Rules, it’s probably best just to set DNS Only.

Written on
Sub-Topics | Search | Subscribe

© 2023 L Warner
To email me humans:
take this site’s domain name
and replace the a. with @
A Moderner Website
← in an IndieWebRing 🕸💍 →