Repository navigation
feat: onEvent, typed update events for your analytics (plan 06 session 2) - #16
Merged
Merged
Conversation
…n 2)
The controller emits check, prompt_shown, prompt_action, store_flow,
ota_downloaded, ota_applied, updated_seen and error events through a new
onEvent option, so headless apps get them too. Each carries the app
version, build, runtime, running update, install source, SDK version,
timestamp and the random installationId; nothing personal. A throwing or
rejecting handler goes to onError with context "onEvent" and never
breaks updating.
The event types live in @upwell/core (StoreFlowResult moved there too).
OtaAdapter.download() may return { updateId }, which expoUpdatesAdapter()
does, so OTA events can name the new update.
Docs: a new guide, "Send update events to your analytics", with PostHog
and Firebase Analytics examples and the dashboards worth building;
onEvent in the controller, React and types references.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RX4BmNghPADsZ6GMRb2ALH
|
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.
Stacked on #11 (
zero-policy-mode): it makespolicyoptional and touches the controller, so this branch builds on it. Merge #11 first; GitHub then retargets this PR tomain.What
A new
onEventoption oncreateUpwell()andUpwellProvider. The controller (not the UI kit) emits typed events, so headless apps get them too. Upwell still sends nothing anywhere itself.checkfresh/cached/none), durationprompt_shownstore.recommended/store.required, once per kind + target per sessionprompt_actionupdate(store flow started from a prompt),later(dismiss()),dismiss(declined Play's own dialog)store_flowota_downloaded/ota_appliedupdated_seenmarkUpdateSeen()while an update is announcederroronErrorCommon fields: timestamp, SDK version, platform, app version, build, runtime, running update id, install source, the random
installationId, and thesimulate()scenario (null on a real device). Nothing personal. A test pins the common keys.A handler that throws or rejects goes to
onErrorwith contextonEventand never breaks updating (and can't loop into anothererrorevent).Other changes:
@upwell/core(packages/core/src/events.ts);StoreFlowResultmoved there (still exported fromupwell).OtaAdapter.download()may return{ updateId };expoUpdatesAdapter()returns the fetched manifest id. Returning nothing still works.sdkVersioncomes frompackage.jsonat runtime (src/version.ts), so the version changesets writes is the one reported.useAppUpdate()is unchanged; the UI kit is untouched.Design decisions (also recorded in the plan)
prompt_shownfires when the decision calls for the prompt, not from a UI callback. That's when the controller already counts a prompt formaxPrompts, it works headless, and the UI kit renders its prompts for exactly those decisions. The catch: a custom UI that doesn't render the prompt still gets the event. The docs say so.ota_appliedwithapplyMode: 'prompt'.nextLaunchOTA updates have noota_applied, because the OTA tool applies them by itself. The nextcheckcarries the newupdateId.Docs
guides/analytics-events.mdx). It covers the event reference, PostHog and Firebase Analytics examples (Firebase reserveserror, so names are prefixedupwell_and fields flattened), volume notes, and dashboards: installs per build, stranded share and prompt conversion, with PostHog SQL.onEventadded to the controller, React and types references, and to the OTA adapter guide (download()result). "Debugging and analytics" now points toonEvent. FAQ, how-it-works and the SDK README updated.Checks
npm run lint,npm run typecheck,npm test(core 169, upwell 96, up from 71) andnpm run buildpass locally. The docs site builds.Changeset:
upwelland@upwell/core, minor.🤖 Generated with Claude Code
https://claude.ai/code/session_01RX4BmNghPADsZ6GMRb2ALH