Docs
Explorar la documentación

Add Privatus Analytics to Statamic

Add cookieless analytics to a Statamic site with one snippet in layout.antlers.html that loads only in production, with no cookies and no banner.

Ver como Markdown

Open your layout, by default resources/views/layout.antlers.html, and add this inside <head>:

antlers
{{ if environment == 'production' }}
  <script defer src="https://privatusstats.com/js/pa.js" data-site="pa_YOURSITEID" data-modules="engage,auto,vitals,clicks,ask"></script>
{{ /if }}

environment is the value of APP_ENV in your .env file. When APP_ENV is not set it is production, so set it to local on your machine.

If your layout is a Blade file, use @production and @endproduction around the same tag.

Statamic serves full pages, so each page view is counted once. If you use the static cache, nothing else is needed because the snippet is part of the cached page. See caching if counts look low.