Verify & Troubleshoot
Confirm events are reaching ClickHouse and diagnose common setup issues like 403 domain blocks, ad blockers, or missing data attributes.
How do you verify that TrimStats is collecting events and diagnose missing traffic?
Open Chrome DevTools Network tab, reload your site, and confirm t.js returns HTTP 200 and POST /v1/collect returns HTTP 202 Accepted. If hits are missing, verify your site domain allowlist, check for localStorage trimstats_ignore=1, confirm data-site matches your key, and inspect CSP console errors.
How analytics beacons behave in the browser
When debugging analytics in browser DevTools, two behaviors often surprise first-time users: requests return HTTP `202 Accepted` (meaning the collector queued the beacon asynchronously without stalling the browser, rather than waiting on a synchronous database commit), and navigator.sendBeacon shows up under the Fetch/XHR or Ping filter with Content-Type: text/plain to avoid extra CORS preflight requests.
POST /v1/collect returns 202 Accepted, the live badge at the top of Overview increments within seconds from Valkey/Redis.Verify in browser DevTools
- 1
Open the Network tab
Open Chrome or Firefox DevTools, switch to the Network tab, enable Preserve log, and filter by
collectort.js. - 2
Reload the page
Confirm
t.jsreturns HTTP 200 and a subsequentPOSTrequest tohttps://collect.trimstats.com/v1/collectreturns HTTP 202 Accepted. - 3
Inspect the beacon payload
Click the
/v1/collectrequest and open the Payload tab. You should see a compact JSON body containings(yourpk_live_...key),t: "pageview", andu(the current URL). - 4
Check the dashboard
Open your site Overview or click Verify installation in onboarding. Live visitor counts update in real time from Redis, and ClickHouse event rows appear within a few seconds.
Diagnosing collector HTTP responses
| Status | Response / Cause | How to fix |
|---|---|---|
202 Accepted | Event queued for ingestion (or silently dropped because the User-Agent matched a bot). | Normal for real browsers. If testing via curl or headless automation, note that bots and navigator.webdriver sessions are intentionally filtered. |
400 Bad Request | Invalid beacon payload | Check custom event payloads or manual API calls against the Collector Beacon API schema. |
403 Forbidden | Origin domain not allowed | The page hostname is not in your site Allowed hostnames list. Add the domain (or staging hostname) under Site settings -> General & Privacy. |
404 Not Found | Unknown site key | Your data-site value does not match an active site. Copy the exact pk_live_... key from Site settings. |
429 Too Many Requests | Monthly event quota exceeded | Your organization exceeded 120% of its monthly plan limit (including the 20% soft grace buffer). Upgrade your plan under Billing & account. |
403 Forbidden on /v1/collect, verify that your live or staging domain appears inside Allowed hostnames under Site settings.Common issues checklist
- No `/v1/collect` request at all: Check whether you previously ran
localStorage.setItem('trimstats_ignore', '1')in that browser, or whether a browser extension blocked the request. - Automated browser tests see zero beacons: TrimStats intentionally exits immediately when
navigator.webdriveristrue(Playwright, Puppeteer, Selenium, Cypress) to keep synthetic test runs out of production analytics. - Script optimizers stripping `data-site`: Some WordPress or CDN script-combining plugins merge external scripts and drop
data-*attributes. Excludet.jsfrom script concatenation and minification. - Staging or `localhost` traffic blocked: When Allowed hostnames is populated in Site settings, requests from unlisted hostnames receive
403. Either leave Allowed hostnames empty during local development or create a separate staging site. - First-party cohorts remain empty: Confirm both
data-mode="first-party"is present on your<script>tag AND First-party ID is saved under Site settings.
Common technical questions
Why does /v1/collect return HTTP 202 Accepted even when a hit is filtered?
Why do I see zero hits when testing on localhost or Vercel preview URLs?
Related guides
Add TrimStats to any website in under 60 seconds with a single deferred script under 2 KB gzipped.
Exclude your own visits, restrict ingestion to approved hostnames, skip specific links, and see how TrimStats drops bots before billing.
HTTP specification for POST /v1/collect, payload validation rules, rate/quota responses, and server-side event ingestion.