Repository navigation
Send the embedded script URL with pageviews - #138
Merged
Merged
Conversation
Fixes #137 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude review checkpointReviewed commit |
|
SDLC label: |
adriaandotcom
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #137
Pageviews now include
src: the URL of the script tag, with everything after?removed. For example,https://scripts.simpleanalyticscdn.com/latest.js?v=3is sent assrc=https://scripts.simpleanalyticscdn.com/latest.js.scriptElement(document.currentScript, falling back to the CDN script tag), so no new lookup is added.srcis left out. An inline script sends an emptysrc. A script element without a stringsrc(for example an SVG<script>) is also skipped, so it can't throw and stop tracking.Depends on the queue:
lib/sanitize.jsonly keeps known fields, so the queue needs to accept and storesrcbefore this data is kept. Without that change, the field is ignored and nothing breaks.Size (minified / gzip -9, excluding the dated header):
latest.js+34 / +14,light.js+34 / +15, other builds +34 / +14–15. Brotli: +14 onlatest.js, +16 onlight.js.Effect on customers: no change to existing data, event names or counts. Each pageview request gets one extra parameter.
Security implications
Has security impact - described as: pageviews include the embedded script URL. The query string is removed, so tokens or parameters in the script
srcare never sent. The URL describes the site's installation, not the visitor.Testing
pnpm run buildandpnpm run test:unit(60 passing). The first version, without thesrcguard, failed the existingdata-metadata-collectortest, whose stubcurrentScripthas nosrc.latest.dev.js,latest.jsandlight.jsin jsdom: no script element → nosrc;…/latest.js?v=3&x=y→…/latest.js;https://example.com/proxy.js→ unchanged; inline script → emptysrc.schedulePingloop onv12is not Prettier-formatted, and I left it unchanged).git diff --checkpasses.Open workspace in Conductor
Checklist