Repository navigation
GitHub star nudge after export, and a cookieless returning-visit metric - #52
Merged
Merged
Conversation
…sits. The star card is once per device and the visit metric stays in localStorage, sending only a day bucket through the existing analytics helper. Co-authored-by: Joan Comadran <joancomadran@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
After the second successful export, the editor shows a one-time GitHub star card. On editor load, a later calendar day sends a cookieless returning-visit event. Photo data, privacy copy, titles, and the Amazon affiliate links are unchanged. No new dependencies.
Changed files
src/lib/analytics.ts—star_nudge_shown,star_nudge_clicked, andreturning_visitsrc/lib/starNudge.ts— once-per-device export count and card statesrc/lib/returningVisit.ts— first and last visit calendar dayssrc/lib/editorCopy.ts— English and Spanish card copysrc/components/StarNudge.tsx— non-modal card (focusable, Escape dismisses)src/App.tsx— mounts the cardsrc/hooks/useEditorSession.ts— counts an export whereexport_completedfiressrc/EditorRoot.tsx— records the visit on editor loadsrc/index.css— card layout, including the phone dockscripts/star-nudge.test.mjsscripts/returning-visit.test.mjse2e/engagement.spec.tslocalStorage keys
lightframes:star-nudge—{ "exports": number, "outcome"?: "shown" | "dismissed" | "clicked" }. The first successful export only stores the count. The second setsoutcometoshownand opens the card. Dismiss setsdismissed. The star link setsclicked. Anyoutcomemeans the card never returns.lightframes:visits—{ "first": "YYYY-MM-DD", "last": "YYYY-MM-DD" }, local calendar days. The first visit only writes the key. A new day updateslastand fires the event at most once that day.No cookies, ids, or photo data.
Analytics events
Sent through the existing
emithelper insrc/lib/analytics.ts:star_nudge_shown— no propertiesstar_nudge_clicked— no propertiesreturning_visit—days_since_first:1,2-7,8-30, or30+1is the next calendar day,2-7is days 2 through 7,8-30is days 8 through 30, and30+is day 31 onward.Checks
npm test,npm run lint, andnpm run buildpassed. Playwrighte2e/engagement.spec.tspassed on desktop and mobile Chromium.Star card on desktop after the second export
Star card on a phone, above the dock
To show artifacts inline, enable in settings.