Add Plausible Analytics or Fathom tracking to Discourse

Is there something I’m doing wrong here? I added the theme component and applied it to the default theme which I’m using and when I view the source on the forum it shows the script there but I’m still “waiting for first pageview” on plausible. I even tried it with the unmodified default plausible script and still nothing shows.

1 Like

Continuing the above discussion: I had the same issue when using the .hash.js script for Plausible.

No page views were recorded, except somehow on a “hard refresh” with Ctrl/Cmd+F5. Subsequent in-app navigations were not recorded.

I removed the .hash part from the script name, reverting back to the standard script, and then all recording seemed to work perfectly! (I tested this by being a Current Visitor and by seeing all the pages I clicked show up in Plausible)

My context:

  • I’m using the Plausible v1.5 image from DockerHub
  • Discourse v3.1.0.beta2 (47abe61994)
  • Note that I also followed the Content Security Policy instructions that were added to the Discourse entry in the Plausible docs 4 months ago (maybe something you missed @JasonH ?)

Could those for whom the .hash.js script was working also report which versions they use? And if it is still working? @itsbhanusharma @justin

There is probably a reason for why there are conflicting reports on this, understanding the versions connected to reports may be a good start to investigate.

1 Like

It seems to work

<script defer async data-domain="yourforum.co" src="https://stats.yourforum.co/js/plausible.hash.outbound-links.js"></script>

Just echoing @th0rgall above: the current documented process in the OP with the script.hash.js script does not seem to work at all, but using the standard script.js link that Plausible provides does seem to work. @JammyDodger @justin would it be possible to comment about the current state of things? Many OSS projects are interested to migrate of GA right now.

Edit: to note that I have added plausible.io to CSP script src

3 Likes

I have zero previous experience with Plausible, but I’ve just signed up for a free trial to test it out and it Just Worked™ by following the onscreen instructions with no additional changes. :partying_face:

If that’s what other people are seeing too then I’m happy to update the instructions. :+1:

Though if there’s anything else I need to be aware of please shout out. :slight_smile:

(also, I didn’t add it to my CSP and I don’t see any errors in the console?)

1 Like

@JammyDodger is the above success with the plain script.js script? If so, that matches my experience. AFAICT things are working since setting up with script.js a few days ago:

1 Like

I have amended the OP. :+1: If anyone notices anything funky please let me know. :slight_smile:

has anyone been able to make use of custom properties feature in plausible? In my case I would like to add topic category and topic tag to plausible as custom properties so that I can segment the clicks of all categories’ and tags’ topics.