Skip to content

Preserve existing script installations when releasing v12 #107

Open

Description

@simple-analytics-ai

What

Preserve existing installations when releasing script v12 in #40:

  • Count distinct manual pageviews while preserving pathname-only path-overwriter input, ignored pages, and hash routes.
  • Use an explicitly supplied manual query with existing parameter filtering. When no manual query is supplied, fall back to location.search. Preserve overwriteSearch.
  • Keep namespaced pageview functions separate from the default tracker, retaining the free legacy alias.
  • Collect phone events while leaving cancelled clicks and navigation to the website and browser.
  • Count Cloudflare challenge arrivals as unique as requested in Pageviews should be unique when Cloudflare's under attack mode is on #48, using the owner's chosen simple marker check (?__cf_ or &__cf_). Keep existing reload/history and later-pageview handling; omit the explicitly declined same-URL guard.
  • Ensure current generated bundles pass deployment validation while older pinned headers remain supported.

Why

Existing embeds should retain their pageview counts, explicit query overrides, website routing, and click behavior when the public scripts update.

Merge status

Merge the remaining PRs into v12 before releasing #40 to main:

Already merged into v12:

Superseded or closed:

Validation

  • Count Cloudflare challenge arrivals as unique #112: 53 offline unit tests and 36 payload checks pass across development, minified CDN, and SRI bundles, including the requested manual-query override/browser-fallback contract. Changed JavaScript formatting and diff checks pass.
  • Accept current and legacy script deployment headers #117: all 15 deployment tests and type checking pass. The header regression checks the current version discovered in dist, current generated headers, legacy headers, and malformed headers.
  • Combined compatibility and deployment changes were also verified locally with the unit suite, deployment suite, type checking, and payload checks.
  • Remote CI and automated review results are tracked on each PR separately from local validation. BrowserStack is not run locally.

Keep shipped JavaScript small, preserve older pinned versions, retain case-insensitive parameter matching, and keep the querykeys opt-out. Build outputs belong with their source changes. Both remaining PRs request adriaandotcom for review.

Activity

  1. simple-analytics-ai commented on Oct 15, 2026

    @simple-analytics-ai
    Author

    Checked unresolved review threads on #40 and #108–#113 against the current v12 head 6b84d4251ea29a2d0744c615223fa3108649e081, prioritizing CodeRabbit. The earlier fix PRs have no unresolved threads.

    CodeRabbit: verified fixes ready for review

    • Keep phone metadata when titles name automatic events #122: titled phone links lose metadata.phone. The fix preserves the title-derived event name and includes the same phone metadata as an untitled link, without the query suffix. A failing regression now passes; 54 offline unit tests pass. Auto-events: +14 minified bytes / +9 gzip bytes, excluding generated headers. Main/light scripts are unchanged.
    • Require current script version in SRI header validation #123: the deployment test can silently validate v11 if v12 is absent. Seven test-only lines now require the discovered SRI version to match dist/latest/latest.js. Reproduced the false pass before and the mismatch failure after; all 15 deployment tests and type checking pass.

    Both PRs independently target v12, are ready for review, and request adriaandotcom. Merge them before #40; no order dependency between them. Original CodeRabbit threads link to the fixes and stay open until their changes land in v12. BrowserStack is not run locally; remote CI is tracked separately.

    Other open comments

    Already handled or deliberately accepted:

    • Query names remain independent of the UTM-value opt-out, as explicitly accepted; querykeys disables the names. Referrer/source suppression also suppresses names through the shared source flag.
    • Default phone collection alongside outbound/email/download is explicitly accepted.
    • The raw-referrer Cloudflare detection correction is merged. Keep the owner's later chosen simple ?__cf_ / &__cf_ marker behavior.
    • Automatic events now use listeners without cancelling clicks or assigning document.location, including phones. The earlier unwanted-navigation comment is fixed in the current source.
    • The two stale-distribution reports are superseded by the current matching generated bundles; the phone fix was rebuilt across latest and unreleased v12 outputs too.

    Still reproducible, outside this focused CodeRabbit fix pass:

    • Manual callback on a skipped pageview: two calls for /repeat produce one request and one callback. A new caller that depends on every callback to continue its flow can hang. The current callback only runs for requests actually sent, so changing this needs an explicit callback-contract decision.
    • Label activation double-counts inline events: one click on <label for="yearly"> inside a data-simple-event="plan_toggle" wrapper produces two events, from the label and its forwarded input click. This affects the new inline feature; existing installations that do not use these attributes are unaffected. Avoid a generic timer-based deduplication that could drop independent clicks.
    • Same-tab automatic-event coverage: the current tests still do not exercise an ordinary same-tab outbound link through the listener-binding path with its fourth keepalive argument. This is a coverage gap, not a reproduced collection failure.
    • Empty callback size optimization: passing 0 in place of the placeholder callback is compatible with the current sendEvent argument handling. Optional byte optimization, not a customer-facing defect; kept out of the phone metadata PR.

    CodeRabbit's general scope/docstring/title suggestions are review housekeeping, not demonstrated customer breakages. The release intentionally spans the accepted v12 changes; bulk docstring additions are not needed for these two fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions