# Add Privatus Analytics to Drupal

> Add cookieless analytics to a Drupal site with our optional module or with one snippet in your theme's html.html.twig, no cookies and no banner.

## With the module

Our module is [Privatus Analytics on drupal.org](https://www.drupal.org/project/privatus_analytics).
Its first release is an alpha, so it is not yet covered by the Drupal
security advisory policy.

1. Add it with Composer:

   ```sh
   composer require 'drupal/privatus_analytics:^1.0@alpha'
   ```

2. Go to **Extend**, tick **Privatus Analytics** and install it, or run
   `drush en privatus_analytics`.
3. Go to **Configuration → System → Privatus Analytics**
   (`/admin/config/system/privatus-analytics`), enter your site id and save.
   Nothing loads until you do.

The module needs Drupal 10.3 or later, or Drupal 11. It skips administration
pages by default, and you can leave out users with chosen roles or paths.
The **Do not track with Privatus Analytics** permission keeps a user out of
your reports. User 1 always has every permission, so user 1 is never tracked.

Other settings map to the tracker's [attributes](/docs/tracker/attributes).

## Without the module

Copy `html.html.twig` from Drupal core's system module templates into your
theme's `templates` folder, then add the snippet before `</head>`:

```twig
<script defer src="https://privatusstats.com/js/pa.js" data-site="pa_YOURSITEID" data-modules="engage,auto,vitals,clicks,ask"></script>
```

Clear the caches (**Configuration → Development → Performance**) so Drupal
uses your copy. A theme snippet counts administration pages and signed-in
users too, so prefer the module if you want to leave those out.
