文件
瀏覽文件

Fix missing analytics data

Analytics showing no data? Work through this checklist: check the script is on the page and loads, that hits are sent and accepted, and the date range is right.

以 Markdown 檢視

Work through these in order.

1. Is the script on the page?#

View the page source (not the developer tools' Elements tab, which shows the DOM after scripts ran) and search for pa.js. Or run Verify installation in Site settings → Tracking, which reads the same HTML (see Verify the installation). Common causes:

  • the snippet is in a template that isn't used on every page,
  • a cache still serves the old HTML (caching),
  • a tag manager trigger isn't published.

2. Does the script load?#

Developer tools → Network → filter pa.js. It should return 200.

  • Blocked or ERR_BLOCKED_BY_CLIENT: an ad blocker. See Ad blockers.
  • Console says Refused to load the script: your CSP.

3. Is a hit sent?#

Filter the Network tab for event. Each page load should POST to /api/event and get 202. If nothing is sent, add data-debug="true" and look at the console. It prints [privatus] not sent: and the reason:

Console message Fix
not sent: missing data-site Add data-site="pa_…". Also printed when a plugin combined pa.js into a bundle (caching)
not sent: domain not in data-domains Add the exact hostname to data-domains, or remove the attribute
not sent: opted out This browser opted out. Run privatus.optIn()
not sent: automated browser You're testing with Selenium, Playwright, Puppeteer or Cypress

Three cases print nothing:

  • A local page (localhost, 127.0.0.1, a .local hostname or a file: URL) sends nothing unless the tag has data-debug or data-allow-local="true".
  • data-exclude matches the page's path.
  • data-manual="true" is set, so no pageview is sent until your code calls privatus.pageview().

A 429 instead of 202 means the hit was rate limited: more than 60 hits in 10 seconds from one IP address, or more than 3,000 a minute for the site. The tracker retries those hits a few times.

Debug mode logs each hit instead of sending it, on every hostname. A data-debug="true" left on a live site means no data, so remove it when you're done.

4. Is the hit accepted?#

A 202 means received, not counted. The server can still drop a hit:

  • The hostname isn't one of the site's domains. Check Site settings → General and add the other domains you use under Additional domains. www. and other subdomains of a listed domain are accepted without adding them. Plain localhost and IP addresses can't be site domains.
  • Wrong site id: the data-site belongs to another site, or to a site that was deleted.
  • Bot filtering: headless browsers, monitoring tools and data-center networks are filtered (Bot rules). A VPN on a cloud provider's network counts as a data center.
  • Traffic rules block the hit by hostname, path, referrer, country, IP range, browser or event name. Would this hit be counted? under Site settings → Traffic rules tests sample values against your rules.
  • GPC or DNT: your browser sends Global Privacy Control and the site honors it (the default), or it sends Do Not Track and the site is set to honor that (off by default). Brave, DuckDuckGo and some extensions turn GPC on. Test in another browser. See DNT and GPC.
  • Collection is paused: the workspace reached its monthly event limit (Monthly limit). Pageviews and custom events are dropped until the 1st of next month or an upgrade. The dashboard shows a banner when the limit is reached.

Site settings → Bots counts the hits dropped by bot filtering and by traffic rules over the last 30 days, which tells you if hits arrive and are dropped.

5. Is the dashboard looking at the right range?#

Check the date range, the filters and segment, and the site's timezone (Timezones). The Live page shows hits within seconds, without any date range.