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.
- In Ghost Admin go to Settings → Code injection.
- Paste the snippet into Site header:
html
<script defer src="https://privatusanalytics.com/js/pa.js" data-site="pa_YOURSITEID"></script>
- 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. The PII scrubber would redact it anyway.