You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Browser script cannot merge its first pageview with a server-created page-load record #101
When a customer records the initial pageview server-side and also loads the browser tracking script, the two systems produce two independent records for a single page load. The server record holds what only the server knows, while the browser knows the viewport and screen sizes, language, time zone, time on page and scroll depth, and there is currently no way for the script to attach that data to the existing record. The result is inflated pageview counts and split metrics for the same visit, and events fired on the page reference a page_id that the server record does not share. There is also no supported way for a server-side integration to hand a per-page-load identifier to the script, and no defined behaviour for what should happen when such an identifier is malformed, reused across cached HTML responses, or points at a path the customer has excluded through data-ignore-pages. Related work is tracked in simpleanalytics/dashboard#901, and the queue side is covered by simpleanalytics/queue#98.
Suggested changes
Allow a server-side integration to pass a per-page-load identifier to the browser script through both a script attribute and a JavaScript settings object, with a defined precedence between them.
Validate the supplied identifier strictly (v4 UUID) and fall back to normal browser-side collection when it is absent or malformed, so a bad value can never silently corrupt collection.
Send the first browser pageview as an append against the supplied identifier, and make later in-page navigations create their own records rather than repeatedly rewriting the initial one.
Define and test the interaction with data-ignore-pages: an excluded initial path should not receive pageview, event or leave enrichment against the server record, including in manual pageview mode where the script's automatic pageview never runs.
Mark browser-submitted data so the backend can distinguish client-collected from server-collected fields.
Document the identifier for customers, including the requirement to generate a fresh value per page load and the risk of embedding it in CDN- or browser-cached HTML.
Add automated coverage that runs against the compiled distribution script in CI before the BrowserStack suite, so regressions in merge and ignore behaviour are caught early.
Activity
simpleanalytics-agent commentedon Oct 19, 2026
Consolidating #100, #102, #103, #104 (closed as duplicates) and #99 here. Requirements from those issues that this one did not list yet:
getHighEntropyValues(). Base attribution decisions on state that is set synchronously when a path is accepted, and cover a pending client-hints promise in tests (Browser tracking script cannot enrich a server-created initial pageview record #102, Server-rendered page loads are counted twice when the browser script also records the initial pageview #103, Server-rendered initial page views cannot be enriched by the browser tracking script #104).appendsubmissions so one site cannot append to another site's records, and needs an expiry or single-use policy for server-created IDs (Page-supplied page-load IDs can redirect appends to arbitrary analytics records, and the repository has lost its pnpm supply-chain policy #99).