Repository navigation
v12 - #40
v12#40
Conversation
It seems Solana from Phantom has this namespace for their browser extension. I added a check for prevent them being detected as bots.
Fix problem with solana extension
…ith-jsdom-and-mocha Add unit tests using jsdom
Save local changes v12-b
…le [no ci] Add AGENTS instructions
…trategy-with-abstractions Add modular tests and helper utilities
* Send visible time on page when the page gets hidden Count only visible time and send the cumulative value on every hide and on pagehide, so durations survive mobile app switches, screen locks and browser kills, back/forward cache restores no longer send increments, and Firefox tab closes are no longer lost. Every page view, including manual ones, closes the previous one. Optional data-pings sends the same value at visible-time thresholds. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Keep invalid scroll readings out of later appends Don't write position() back into the scroll maximum, so a NaN reading on a zero-height layout can't stick for the rest of the page view, and drop the unobservable push branch of the sent watermark. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Send time on page only when the page gets hidden Leaving a page also makes it hidden, so the pagehide listener, the duplicate-send guard, the back/forward cache fallback and the beacon try/catch are no longer needed. Old browsers that don't fire visibilitychange on navigation lose those durations; this keeps the script small. Appends without values are not sent. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Ignore huge ping values and hides before the first page view A ping value too large for setTimeout fired immediately and rescheduled itself in a loop, and ignored pages or manual mode sent an append for a page view that was never sent on every hide. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Conductor Adriaan <conductor@adriaan.simpleanalytics.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Ask agents to weigh script size against edge cases Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Stop asking agents to commit generated distributions The Dist section says feature work never commits dist/, which item 6 contradicted. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Conductor Adriaan <conductor@adriaan.simpleanalytics.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Documentation update
|
The merge from main renamed the custom destination to caddy, so the header test matched no custom files and typecheck failed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Runs auto-events.js on a same-tab outbound link and checks that it binds a click listener instead of an onclick attribute, leaves the click alone, and asks sa_event for keepalive. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
sendEvent already uses a noop for a missing callback, so 0 is enough to reach the keepalive argument. Saves 11 bytes minified, 1 gzip. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Other scripts can replace navigator.sendBeacon with a wrapper that throws "Illegal invocation" (#42). Without the fallback no time on page arrives, the remaining pings stop and every hide throws an error. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Cloudflare challenges run on the site itself, so a challenge marker in a referrer from another non-unique hostname no longer makes the first pageview unique. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The challenge page replaced the original referrer, so the pageview only sent our own hostname. The queue turns pageviews with our own hostname as referrer non-unique, which undid the unique arrival. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Documentation update
|
The cleaned referrer has no www. and can carry an overwritten hostname, so www sites kept sending their own hostname as referrer (which the queue turns non-unique) and sites with a matching non-unique hostname sent unique=false. Check the raw referrer first, before sameSite. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The cleaned referrer has no www. and uses the defined hostname, so on www sites and sites with data-hostname internal page loads and manual pageviews were sent as unique, and SPA pageviews and events on data-hostname sites lost their referrer. Compare the raw referrer host with the location host, and treat later pageviews as same-site. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Appends from data-pings now include ping: true, so the backend can block them for plans without pings. Appends sent on hide or navigation are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
| @@ -73,20 +75,9 @@ | |||
| if (typeof optionsLink === "undefined") | |||
| log("options object not found, please specify", "warn"); | |||
|
|
|||
| window.saAutomatedLink = function saAutomatedLink(element, type) { | |||
| var saAutomatedLink = function saAutomatedLink(element, type) { | |||
There was a problem hiding this comment.
Why this change? Shouldn't it be on window anymore?
| } | ||
| } catch (error) { | ||
| log(error.message, "warn"); | ||
| } | ||
| }; | ||
|
|
||
| function collectLink(link, onclick) { | ||
| window.saAutomatedLink = saAutomatedLink; |
There was a problem hiding this comment.
This is basically double then, no?
| link.addEventListener("click", function () { | ||
| saAutomatedLink(this, collect); | ||
| }); |
There was a problem hiding this comment.
Wouldn't it make sense to keep the saAutomatedLink function just internally only? Why expose to window?
| // Only initialize in a browser. | ||
| if (!window) return; |
There was a problem hiding this comment.
Why is there no /** if skipnonwindow **/ because it was there before, no?
Summary
Fixes #97
Prepare public script v12:
Before merging, update beta.js as well or inform customer team 13489e0b-295c-476b-b955-46389fe10895.
Security implications
Has security impact - described as: - [ ] No security impact - [x] Has security impact - described as: - Query parameter values are never collected by this addition. - Name collection is limited to parameters with non-empty values and can be disabled.
Testing
Checklist
Summary by CodeRabbit
Open workspace in Conductor