GuidesWeb

Drupal analytics, cookieless and EU-hosted

Privacy-first analytics for Drupal, no cookie banner needed.

Privytics adds page view and event tracking to your Drupal site with one snippet you paste once. The usual choice on Drupal is the Google Analytics module (GA4), which needs a consent banner for EU visitors. Privytics is cookieless and EU-hosted, so it is paste one snippet, with no consent banner for anonymous visitors. Drupal has no built-in place for site-wide tags, so you first turn on one free, no-code helper module, then paste and save.

Why Drupal teams use Privytics

Nothing is stored on the visitor's device

The snippet sets no cookies and saves no id in the browser. Visitors are counted with an anonymous id that resets every day, so there is nothing to store and nothing to consent to.

Your data is stored in the EU

Every event is stored in EU data centres in Germany. For government, university and enterprise Drupal sites, that keeps your analytics data stored inside the EU by default.

No cookie banner for the anonymous case

Because nothing is written to the device and no cookie is sent, there is nothing to ask consent for. You stay the data controller and skip the banner most GA4 setups need.

Free to start, page views included

The free plan covers 10,000 events a month with no card. Page views start counting the moment the snippet is live, with 12-month history on free, and 5-year event history plus session replay on paid.

Set it up

About five minutes, on the free plan, without a credit card.

  1. Turn on the free Asset Injector helper

    Drupal has no built-in field for site-wide tags, so add one small free module that lets you paste code with no theme editing. Install Asset Injector from drupal.org or with the command below, turn it on under Manage > Extend, then go to Manage > Configuration > Development > Asset Injector > Add JS injector. If your site is run by a host or agency, this one-time module step may need their help.

    composer require drupal/asset_injector
  2. Paste your Privytics snippet and save

    Give the injector a name like Privytics. In the Code box, paste the two tags below. Replace YOUR_CLIENT_ID with the client id from your Privytics project, then Save. Placement does not matter for this snippet, so the default footer is fine; if you prefer, open Advanced options and tick the box to load it in the header. If your site caches pages, clear the cache under Manage > Configuration > Development > Performance so the change goes live.

    <script>
      window.op=window.op||function(){var n=[];return new Proxy(function(){arguments.length&&n.push([].slice.call(arguments))},{get:function(t,r){return"q"===r?n:function(){n.push([r].concat([].slice.call(arguments)))}} ,has:function(t,r){return"q"===r}}) }();
      window.op('init', {
        apiUrl: 'https://api.privytics.com',
        clientId: 'YOUR_CLIENT_ID',
        trackScreenViews: true,
        trackOutgoingLinks: true,
      });
    </script>
    <script src="https://privytics.com/op1.js" defer async></script>
  3. Check that page views are arriving

    Open your Drupal site in a normal browser tab, then open your Privytics dashboard and look at the Realtime view. Your own visit should show up within a few seconds. Page views are tracked automatically from now on, with no extra setup, and that is the main thing most sites need.

    Privytics dashboard  >  your project  >  Realtime
  4. Optional: count one button click

    Want to count a specific action like a signup or a Contact click? Add a second JS injector the same way (Add JS injector), give it a name, and paste the line below. Change signup_click to your own label, and change #signup-button to the button on your page. This runs as first-party code on your own pages, so it needs no extra tags. It is a small piece of code, so if you would rather not touch it, whoever manages your site can add it in a minute.

    document.querySelector('#signup-button')?.addEventListener('click', function () {
      window.op('track', 'signup_click');
    });

Questions

Does this need a paid plan?

No. The free plan tracks up to 10,000 events a month with no card, and page views are included. Session replay and 5-year event history are paid extras you can add later, but the core analytics you set up here is free.

Do I still need a cookie banner?

The snippet writes nothing to the device and sends no cookie, so for anonymous visitors there is nothing to consent to. You remain the data controller. This is the main reason Drupal teams move off the GA4 module, which does need a banner for EU visitors.

Where is my data stored?

In EU data centres in Germany. Privytics runs the open-source OpenPanel engine, and your events are stored in the EU by default, which suits public sector and university sites.

Can I track button clicks or events?

Yes. Page views are tracked automatically with no setup. To count a specific action like a signup, add a second JS injector with one short line, window.op('track', ...), as shown in the optional step. No extra tags are needed. If you would rather not paste code, whoever manages your Drupal site can add it quickly.