文件
瀏覽文件

Add Privatus Analytics to Kirby

Add cookieless analytics to a Kirby site with one snippet in the header snippet of your theme that skips debug mode, with no cookies or banner.

以 Markdown 檢視

Kirby templates share their top of page in a snippet, in the Starterkit site/snippets/header.php. Add this inside <head>:

php
<?php if (option('debug') === false): ?>
  <script defer src="https://privatusstats.com/js/pa.js" data-site="pa_YOURSITEID" data-modules="engage,auto,vitals,clicks,ask"></script>
<?php endif ?>

Kirby's docs recommend keeping the debug option off in production, so this loads the tracker on your live site and not while you build. Set it in site/config/config.php.

If your templates don't use a shared header snippet, add the tag to each template's <head> instead. Add other options as attributes.