Support Fathom Analytics (PR #13791)

We’ve been flooded with support tickets over the last year with people who are wanting to use Discourse and have privacy-first analytics instead of Google Analytics. Fathom is the market leader, with companies such as Fastmail, GitHub, Buffer, Tailwind, Tuple and others using it.

This isn’t a sales pitch though. My hope is that we can get this added in to have automatic Fathom support when someone adds our snippet in.

Thanks for your consideration :slight_smile:

GitHub

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Thanks but we can’t even look at this until you sign the CLA. Are you willing to do so?

@eviltrout All I did here with this tiny code modification is use your existing code and add public Fathom code (farhom.trackPageview). This code I contributed here is your code that I modified slightly. It’s not my intellectual property.

If you’re needing me to sign a CLA for copying your code and adding in fathom.trackPageview(), I can consider it :wink:

Like I said I can’t even look at it unless you sign the CLA. Even small changes need to sign the CLA.

@eviltrout Sorry Robin, I completely understand now. The CLA is for everyone’s protection, as people could claim you “saw their ideas and copied it”. I’ve gone ahead and signed it.

Thanks for signing the CLA. I’ve reviewed the code now and it is the wrong approach for enabling it in Discourse. This will correctly activate but only if fathom has already been included another way. Instead I’d recommend making this a theme component or plugin that people can install which would include the correct code to launch fathom as well as enable it when pages change like this.

Here is an example of a theme component that does something similar: