Drupal analytics module

The StatJolt Drupal analytics module adds your tracking code to every page of your site. You paste the code once. The module works out where it belongs and checks that data is really arriving.

The statistics are cookieless. No cookie banner, no personal data and nothing written to your Drupal database. No new tables, no log rows and no queue. If you want the reasoning, read analytics without a cookie banner.

Install it in four steps

  1. Download the module from StatJolt and unpack it into your site's modules folder.
  2. Open Administration, then Extend. Search for StatJolt, tick it and install it.
  3. Open Administration, then Configuration, then System, then StatJolt Analytics. Open your StatJolt account, press the copy button under your code, then paste it into the field and save.
  4. Open your site in a private window. The status turns green once the first visit arrives.

You can paste the whole snippet, only the script line or only the number. All three work.

The download is a zip file. Unpack it so that the statjolt folder itself lands in modules, with the file statjolt.info.yml inside it.

What the status colours mean

  • Green. Data is arriving. Nothing to do.
  • Amber, waiting for your first visitor. The code is in place but nobody has loaded a page yet. Open your site in a private window.
  • Amber, no visit seen from your domain. The code is saved but StatJolt has not received anything from this address. Check that you pasted your own code, then clear your cache.
  • Amber, StatJolt could not be reached. Your server could not call statjolt.com just now. Tracking still runs. Press Check again in a minute.
  • Red, the ID does not exist. The number you pasted belongs to no StatJolt account. Copy your code again.
  • Red, the domain is switched off. You marked this domain as not yours in your StatJolt account. Turn it back on in your site list.

The screen also warns you on the status report while no code is pasted so an unfinished setup does not go unnoticed.

Which Drupal versions it works on

Drupal 10 and Drupal 11. The module is written against the current APIs so it needs no compatibility layer.

Drupal 9 is not supported. It reached end of life in November 2023 and no longer receives security patches. If you are still on it, the useful step is not a new analytics module.

The module ships with its interface in nine languages: English, Hungarian, German, Spanish, French, Portuguese, Italian, Dutch and Polish.

Where the code goes

Nothing to configure. The module writes the code into the finished response, immediately before the closing body tag, on every front end page.

That matters more on Drupal than it sounds. Most modules attach tracking as an asset library, which means your aggregator can reorder it, defer it or bundle it with everything else. This module never enters that pipeline. It edits the page after your theme has finished with it so it does not care which theme you run or which regions it has. There is more on what tracking scripts cost you in slow websites and tracking scripts.

You cannot break it by placing the badge twice either. The tracking code goes in from one place only so double counting is not possible.

Where the badge goes

StatJolt shows a small badge on your site. By default it places itself in a corner of the screen and the module asks you nothing.

When you want it somewhere specific, you have two ways. Place the StatJolt badge block in any region from Block layout, the same way you place any other block. Or put the {statjolt_badge} token in your text and enable the StatJolt badge filter on that text format.

Give the filter a high weight so it runs after the filter that limits allowed HTML.

The block and the token only mark the spot. The tracking code still goes in at the bottom of the page on its own so a page without either is measured just the same.

Caching

The code the module adds is the same for every visitor so you do not need to exclude anything from your cache.

Saving your ID clears the cached pages that hold the old code. Drupal does this on its own, because the module tags its output with its own settings. There is nothing to purge by hand. If you also run a CDN or a reverse proxy in front of Drupal, clear that one once.

Skipping logged in users is safe under caching too. Drupal serves the anonymous page cache to anonymous visitors only so nobody ever receives a page built for someone else.

Who is not counted

Logged in users are skipped. You can turn that off with a single checkbox if you want to see your own visits.

Administration screens are never touched. Neither is anything that is not an HTML page, such as JSON responses, ajax callbacks, feeds and file downloads. Those are not pages a visitor reads so counting them would only distort your numbers.

What the module stores

Your settings and nothing else. They live in one configuration object, the same place every other module keeps its settings.

There are no custom tables and no per visit writes. That is the whole point of the design. An analytics module that logs to your own database turns every page view into a database write on the same database that serves your site and your backups carry the weight of it forever.

Raw IP addresses never reach disk on the StatJolt side either. The visitor identifier is a hash that is regenerated with a new salt every midnight so yesterday's visitor cannot be matched to today's. The full detail is in the privacy policy.

If you are coming from Google Analytics

You do not need to keep both running. StatJolt replaces the page view, source, page and device reporting you were using GA4 for. It adds Core Web Vitals, funnels and user journeys that GA4 either buries or does not have. There is a fuller comparison in the GA4 alternative guide.

The bigger change is the consent banner. StatJolt sets no cookies and collects no personal data so most sites need no banner at all. The legal side is in Google Analytics and the GDPR.

Running WordPress, Joomla or Webflow somewhere too? There is a StatJolt WordPress plugin, a Joomla plugin and a Webflow guide as well. The same account and the same snippet cover every site you own.