Search by

privatus / statamic-privatus-analytics

ja-andrews

See how many real people visit your Statamic site, without cookies. Adds the Privatus Analytics script and shows your stats on the Control Panel dashboard.

Package info

github.com/Privatus-Analytics/statamic-privatus-analytics

Homepage

Documentation

Type:statamic-addon

pkg:composer/privatus/statamic-privatus-analytics

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-10-28 06:56 UTC

This package is auto-updated.

Last update: 2026-10-28 07:23:40 UTC


README

Real visitor numbers for your Statamic site. No cookies, no cookie pop-up, no bots.

You want to know if people visit your Statamic site. But Google Analytics uses cookies, so in many countries you must show a cookie pop-up first (the box that asks visitors to say yes to cookies). Many people click no, so they never show up in your numbers. Bots add fake visits on top.

This addon adds the Privatus Analytics script to your Statamic pages. The script sets no cookies and keeps no IP addresses. Bots are filtered out before they are counted.

So you see how many real people came, which pages they looked at and where they came from. You see the headline numbers right on your Control Panel dashboard, and the full report on privatusanalytics.com.

Free plan, no card: 10,000 events a month (an event is a page view or an action you track) on up to 3 sites. Start free at privatusanalytics.com.

  • No cookies. No cookies and no hidden IDs on your visitors' devices, and no IP addresses are kept. Laws differ by country, so check your own legal advice.
  • Real people, not bots. Known bots, data centers and spam visits are left out on every plan.
  • Small and fast. The script is about 3 KB when compressed.

What this addon does

  • Adds the tracking script before </head> on every front-end page. No template changes needed.
  • Adds a dashboard widget with visitors, page views, bounce rate, time on site and your top pages.
  • Gives you Antlers tags to track button clicks and form sends without writing JavaScript.
  • Never counts editors looking at drafts in Live Preview, and leaves the Control Panel alone.
  • Only adds a script to the page. It never sends data from your server.

Requirements

  • Statamic 6
  • PHP 8.3 or later
  • A Privatus Analytics account (the free plan is fine)

Install

Run this in your Statamic project:

composer require privatus/statamic-privatus-analytics

You can also find it in the Statamic Marketplace.

Set up

  1. In Privatus Analytics, add your site and copy its site ID. It starts with pa_ and is under Site settings, Tracking.

  2. In Statamic, go to Tools, Addons, Privatus Analytics, Settings and paste the site ID. Or add it to your .env file:

    PRIVATUS_SITE_ID=pa_YOURSITEID

That's it. The script now loads on every page when APP_ENV is production. It stays off on your own computer, so your test visits are not counted.

Static caching works out of the box, because the script is part of the cached page.

Settings

Setting Where What it does
Site ID Control Panel or PRIVATUS_SITE_ID Your site ID. Must look like pa_ plus letters and numbers.
Add the script to every page Control Panel or auto_inject Turn it off if you would rather place the tag yourself.
Modules Control Panel or modules Time on page, outbound links and downloads, page speed, click maps, on-page surveys.
Paths to skip Control Panel or excluded_paths Pages that are never counted, like /members/*.
On or off PRIVATUS_ENABLED true or false forces the script on or off in any environment.
API token PRIVATUS_API_TOKEN Lets the dashboard widget read your numbers. Keep it in .env only.

Settings saved in the Control Panel win over the config file. To change the config file, publish it first:

php artisan vendor:publish --tag=privatus-analytics-config

Dashboard widget

  1. In Privatus Analytics, go to Account, API tokens and make a read-only token. It starts with pat_.

  2. Add it to your .env file:

    PRIVATUS_API_TOKEN=pat_...
  3. Add the widget to config/statamic/cp.php:

    'widgets' => [
        ['type' => 'privatus_analytics', 'width' => 'full', 'period' => '7d'],
    ],

period can be today, 7d, 30d, mtd (this month) or 12mo. Numbers are kept for 10 minutes, so the dashboard stays fast.

Place the tag yourself

Turn off Add the script to every page, then add this inside <head> in your layout:

{{ privatus_analytics }}

In a Blade layout:

<s:privatus_analytics />

The tag prints nothing outside production or when the site ID is missing.

Track clicks and form sends

Add an event to any link, button or form. Every parameter except name becomes a property you can filter by later.

<a href="/pricing" {{ privatus_analytics:event name="Pricing CTA" }}>See pricing</a>

<button {{ privatus_analytics:event name="Play video" video="intro" }}>Play</button>

<form method="post" action="/contact" {{ privatus_analytics:event name="Contact form" topic="sales" }}>

On a form, the event fires when the form is sent. Form fields are never read.

Name an element for click maps:

<a href="/signup" {{ privatus_analytics:click name="hero.signup" }}>Start</a>

For events from your own JavaScript, use window.privatus.track('Signup', { plan: 'pro' }). See the events docs.

Testing

./run-docker.sh

This runs the tests, the code style check and a real Statamic 6 site in Docker that checks the script lands in the page.

Links

License

MIT. Copyright Two Phase LLC.