Repository navigation
Add an install suggestion dialog and optional listing-opened and install-prompt counts - #14
Merged
Merged
Conversation
… suggestion dialog Extends the fixed event contract from six to nine broad kinds: resource_open (listing detail opened, attributable), install_prompt_show and install_prompt_dismiss (never attributed, like install). Adds a center-screen install suggestion on the home directory: shown once per visit after 3s when installable, native prompt where the browser offers one, Add to Home Screen guidance on Apple touch browsers, 14-day local dismissal courtesy period, Esc/backdrop/button dismissal, no inline script or style so CSP hashes are unchanged in shape. Kingston disclosure updated to name the new counts. Checks: npm run check -- --all PASS.
Funnel events (all except install and install-prompt signals) now carry a visit field: a random token generated at page load, never stored, rotated on any revocation or suppression. Installation and prompt signals never carry it so they stay unlinkable to outreach labels. Static constants and event payloads cannot override it. Kingston disclosure and the generic analytics explanation updated. Targeted unit and browser analytics tests pass.
The current collector contract (KFH_ANALYTICS_CONTRACT.md, ingestion v3) accepts exactly six event types with strict keys and forbids unknown keys and visitor/session IDs. Sending the new kinds or the visit field would drop events server-side. Rework so the wire format stays exact v3: - Kingston event_payloads and attribution restored to the six reviewed events; disclosure restored to match what is actually collected. - resource_open and install-prompt kinds become optional capabilities, sent only where a deployment configures payloads under a collector contract that accepts them (validation now requires the six established payloads; the three new kinds are optional). - The per-visit token is gated on the new visit_linkage flag, off for Kingston; docs state it must stay off until the reviewed contract accepts the field. Unit fixture and browser collector test enable it to keep the capability covered. - The install prompt UI is unaffected (product feature, no analytics dependency); its show/dismiss signals stay inert until the contract expansion. Targeted tests: 20/20 analytics+contract unit, 6/6 webkit collector e2e.
Restoring an already-open listing after search, filter or refresh fired the toggle listener and would have sent resource_open again.
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.
Before: the only install path was the small "Install Food Help" button on inner pages, and the analytics adapter knew six event kinds.
After: the home directory shows a centered "Keep this directory on your device" suggestion 3 seconds after load, once per visit, only where the browser can install (native prompt) or on Apple touch browsers (Add to Home Screen instructions). "Not now", Esc or the backdrop dismisses it for 14 days on that device. It is hidden in print, never shown on review previews or when already installed, and needs no inline script or style.
The analytics adapter also gains three optional kinds (
resource_open,install_prompt_show,install_prompt_dismiss) and an optionalvisit_linkageflag. None of them is sent unless a deployment configures payloads or turns the flag on. No deployment does: Kingston's config is unchanged and still sends exactly the six established v3 events, and Brockville has analytics disabled.How: new dialog markup in
scripts/lib/web.ts, behaviour insrc/main.ts, schema and validation for the new optional keys, docs indocs/analytics.mdanddocs/configuration.md. Re-rendering after a search or filter restores open listings without counting them as new openings. No listing data, deployment config or service worker changes.Checks:
npm run check -- --allpasses (80 unit/contract tests, 32 Chromium browser tests).Generated by Claude Code