Dokumentacja
Przeglądaj dokumentację

Tracker debug mode

Use tracker debug mode to log every hit to the console without sending it, send real hits from localhost, and check the /api/event request in your dev tools.

Zobacz jako Markdown
html
<script defer src="https://privatusstats.com/js/pa.js" data-site="pa_YOURSITEID" data-modules="engage,auto,vitals,clicks,ask" data-debug="true"></script>

With data-debug="true" the tracker:

  • logs every hit to the browser console as [privatus] pageview {…}, with the exact request body,
  • doesn't send anything, so debugging never pollutes your data,
  • runs on localhost, other local hosts and file://,
  • logs why a hit wasn't sent ([privatus] not sent: opted out, …: domain not in data-domains, and so on).

Sending from a local server#

To send real hits while developing (for example, to test goals end to end on a development site), use data-allow-local="true" instead.

The server only keeps hits whose hostname is the site's domain, one of its additional domains or a subdomain of one. A site domain needs a dot and a top-level part, so plain localhost and IP addresses such as 127.0.0.1 can't be added and their hits are always dropped. Serve your local copy under a hostname that can be a site domain, such as myapp.local or a subdomain of your real domain, and create a separate site for it so test hits stay out of your real data.

Checking the network request#

In the browser's developer tools, Network tab, filter for event. Each hit is a POST to /api/event that gets a 202 Accepted. See What the tracker sends for the body.