Dokumentation
Gennemse dokumentationen

Add Privatus Analytics to Ghost

Add privacy-friendly analytics to a Ghost site through code injection, and count member and newsletter signups as an event without sending email addresses.

Vis som Markdown
  1. In Ghost Admin go to Settings → Code injection.
  2. Paste the snippet into Site header:
html
   <script defer src="https://privatusstats.com/js/pa.js" data-site="pa_YOURSITEID" data-modules="engage,auto,vitals,clicks,ask"></script>
  1. Save.

Members and newsletter signups#

Ghost's signup forms use data-members-form. To count signups as an event, add this after the snippet:

html
<script>
  document.addEventListener('submit', function (e) {
    if (e.target.matches('[data-members-form]')) {
      privatus.track('Newsletter signup');
    }
  }, true);
</script>

Never send the email address as a property. With the PII scrubber on, it would be redacted anyway.