文件
瀏覽文件

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. 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 the reason:

Console message Fix
not sent: missing data-site Add data-site="pa_…"
not sent: localhost Expected on local servers. Use data-allow-local="true" if you really want to send
not sent: domain not in data-domains Add the 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

Also check data-exclude doesn't match the page.

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 www. variants or other domains you use. (Subdomains of a listed domain are accepted.)
  • Wrong site id: the data-site belongs to another site.
  • 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 your IP, path or country.
  • GPC or DNT: your browser sends Global Privacy Control and the site honours it (the default). Brave, DuckDuckGo and some extensions turn GPC on. Test in another browser.
  • Collection is paused: the workspace reached its monthly event limit (Monthly limit), or the email address isn't verified yet. The dashboard shows a banner when the limit is reached.

The Overview's footer counts bot-filtered and rule-blocked hits, 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.