Load Privatus Analytics with Cloudflare Zaraz
Load the Privatus Analytics tracker through Cloudflare Zaraz with a Custom HTML tool, handle Zaraz single-page app support and send events from your site.
Zaraz loads third-party tools from Cloudflare's edge. Use a Custom HTML tool to load the Privatus tracker.
- In the Cloudflare dashboard open your zone and go to Zaraz → Tools configuration → Add new tool → Custom HTML.
- Name it "Privatus Analytics" and paste:
<script defer src="https://privatusanalytics.com/js/pa.js" data-site="pa_YOURSITEID"></script>
- Firing trigger: Pageview.
- Save and publish.
Zaraz's "HTML" tools inject the script into the page, so it runs in the visitor's browser like the normal snippet and supports every attribute.
Single-page app setting: if Single Page Application support is on in Zaraz, it re-fires Pageview triggers on route changes. The tracker already tracks those itself and ignores a second pageview for the same path, but you should still use the tracker's SPA handling only: exclude the tool from SPA re-triggering or keep Zaraz's SPA support off.
Events#
Call the JavaScript API from other Zaraz tools or from your site with
privatus.track(…). Zaraz's own zaraz.track() doesn't forward to
Privatus.