Add Plausible Analytics or Fathom tracking to Discourse

Adding the Fathom or Plausible Content security policy script src is no longer required due to update Content-Security-Policy now uses 'strict-dynamic'

Ash @ Fathom reports they will be updated their Discourse doc.

Both Fathom and Plausible are work fine with these added Components:

<script src="https://cdn.usefathom.com/script.js" data-spa="auto" data-site="yourcode" data-canonical="false" defer></script>

<script defer data-domain="YOUR-Domain" src="https://plausible.io/js/script.js"></script>

This may seem obvious but… The components with either Plausible or Fathom scripts apparently won’t work unless attached to a theme set as “default”. I have not tried on a site with multiple themes available but I suspect the analytics components won’t be called without a default theme selected. Seems odd given Discourse otherwise works fine, best I can tell, using the default Discourse theme without declaring it as default.

@Falco Maybe forcing a default selection would be useful.

1 Like