Create a new theme component from Admin > Customize > Themes.
Then paste the tracking code in the </head> section.
Click Save.
Make sure to add this to all available themes so you can track analytics across all users!
That’s it!
If you don’t see data flowing, the script may be blocked by your CSP settings. Check your browser console and if you’re getting errors, add https://plausible.io/js/script.js to your CSP settings.
According to Plausible’s roadmap on Github it seems that it’s going to be possible sometime in the near future to embed one’s Plausible page into one’s website.
Hey @Falco, has anything changed about your frontend routing? I can see you recommend people use the hash version of our script which is provided for hash-based routers. It seems to me like Discourse is using the HTML5 PushState API now, is that correct?
I use plausible and I can confirm that the regular plausible.js does NOT log the urls if a user moves from topic to topic. So if I need accurate representation of my visitors, I have to use the hashed plausible js.
Weird to have these conflicting reports. Theoretically since Discourse uses the HTML5 history API, I would think that our standard script (not the hash script) would be the one that tracks correctly.
Unfortunately I don’t have a discourse instance set up that I could test with.
Probably my lack of knowledge about that I originally went with the hash version due to us being a SPA and having custom tracking for other analytics providers. If plausible.js works, feel free to change it!
Dumb question. Does adding this feature track what’s going on inside your discourse community or does it track outbound traffic to another domain the community is linked to?
Update: The guys at Fathom put together a simple doc to walk you through what you need to do. Enjoy!
Fathom Note: There may be a way to change it, but Discourse adds the rel="canonical" tag for all pages back to the homepage. So all of our page views in Fathom showed as only coming from the homepage.
I talked to Fathom and they said, add this to your tracking script, canonical="false" so it looks as below.