Dok.
Bla i dokumentasjonen

Install Privatus Analytics with Google Tag Manager

Load the Privatus Analytics tracker from a Google Tag Manager Custom HTML tag, set consent settings, send events from GTM triggers and avoid double counting.

Vis som Markdown

If your site already loads tags through Google Tag Manager, you can load Privatus Analytics from it. Adding the snippet directly to your pages is still more reliable: GTM itself is blocked by many ad blockers.

Custom HTML tag#

  1. In your container go to Tags → New → Tag configuration → Custom HTML.
  2. Paste:
html
   <script defer src="https://privatusanalytics.com/js/pa.js" data-site="pa_YOURSITEID"></script>
  1. Trigger: Initialization - All Pages (or All Pages).
  2. Save, preview, and Submit to publish.

GTM copies the data- attributes onto the script it inserts, so every attribute works as usual.

Privatus Analytics sets no cookies and reads nothing from the device, so in GTM's Consent settings for the tag you can choose No additional consent required if that matches your legal assessment. See Privacy & compliance.

Sending events from GTM#

Create more Custom HTML tags that call the JavaScript API, fired by your GTM triggers:

html
<script>
  window.privatus && privatus.track('Contact form', { form: {{Form ID}} });
</script>

{{Form ID}} here is a GTM variable. Only send values that contain no personal data.

Single-page apps#

Don't fire the tag again on "History change" triggers. The tracker already follows history.pushState navigations, so firing it twice double counts. See SPA double counting.