Dokumentation
Gennemse dokumentationen

Add Privatus Analytics to Discourse

Add cookieless analytics to a Discourse forum by pasting one snippet into your theme's Head tab, and allow the script in the content security policy.

Vis som Markdown

You need to be an admin of the forum.

  1. Go to Admin → Customize → Themes.
  2. Select your active theme and choose Edit CSS/HTML.
  3. Open the Head tab and paste the snippet:
html
   <script defer src="https://privatusstats.com/js/pa.js" data-site="pa_YOURSITEID" data-modules="engage,auto,vitals,clicks,ask"></script>
  1. Save, then reload the forum.

You can also put the snippet in a theme component and add the component to your theme, so it survives a theme change.

Content security policy#

If the browser console reports the script as blocked, add the tracker host (https://privatusstats.com) to Discourse's content security policy script src site setting under Admin → Settings.

Discourse is a single-page app. The tracker follows its history.pushState navigations automatically, so each topic or list view counts once. See single-page apps.