# 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.

1. In Ghost Admin go to **Settings → Code injection**.
2. Paste the snippet into **Site header**:

   ```html
   <script defer src="https://privatusanalytics.com/js/pa.js" data-site="pa_YOURSITEID"></script>
   ```

3. 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](/docs/privacy/pii-scrubbing) would redact it anyway.
