fix(analytics): emit screen.viewed for the Scan/Receive tabs#951
Open
CassioMG wants to merge 2 commits into
Open
fix(analytics): emit screen.viewed for the Scan/Receive tabs#951CassioMG wants to merge 2 commits into
CassioMG wants to merge 2 commits into
Conversation
ScanReceiveScreen still passed its per-tab VIEW_* slug to track() as the event name, which the screen-view guard added by the property-model foundation (#936) drops: [Analytics] Screen-view "view_public_key_generator" passed to track() directly; emit SCREEN_VIEWED via the navigation choke points instead. Event dropped. Route both tabs through getScreenViewedProps() and emit SCREEN_VIEWED, matching the BottomSheet choke point. Also catalog VIEW_SCAN_QR_CODE, which was absent from SCREEN_CATALOG: the guard could not recognise it, so the Scan tab silently emitted a bare "scan_qr_code" event instead of screen.viewed. Existing tests passed through both bugs because they mock track(); they now assert the emitted event name and props. Refs https://stellarorg.sentry.io/issues/7633220935/ Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Scan/Receive tab analytics to emit canonical screen.viewed events with the correct metadata.
Changes:
- Routes both tab views through
getScreenViewedProps(). - Catalogues the Scan tab under the assets flow.
- Updates regression tests for event names and properties.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/config/analyticsConfig.ts |
Adds Scan to the screen catalog. |
src/components/screens/ScanReceiveScreen/ScanReceiveScreen.tsx |
Emits canonical per-tab screen views. |
__tests__/config/analyticsConfig.test.ts |
Verifies both tabs’ analytics metadata. |
__tests__/components/screens/ScanReceiveScreen/ScanReceiveScreen.test.tsx |
Verifies canonical event emission. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
iOS Simulator preview build is ready: https://github.com/stellar/freighter-mobile/releases/tag/untagged-d2b17172b04c260891ec (SDF collaborators only — install instructions in the release description) |
This comment was marked as resolved.
This comment was marked as resolved.
The guard loop iterated mock.calls without asserting any call was made, so it would have passed vacuously if both tabs stopped resolving to catalogued screens -- the exact regression it guards against. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This comment was marked as resolved.
This comment was marked as resolved.
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.
What
ScanReceiveScreennow emits its per-tab screen views asscreen.viewed(viagetScreenViewedProps(), same asBottomSheet) instead of passing theVIEW_*slug totrack()as an event name. Also adds the missingVIEW_SCAN_QR_CODEentry toSCREEN_CATALOG.Why
Every view of the Receive tab logged:
Sample: https://stellarorg.sentry.io/issues/7633220935/
#944 added the unified screen firing
track(VIEW_ACCOUNT_QR_CODE); #936 then made screen views a singlescreen.viewedevent with a guard that drops screen-view slugs passed as event names. The screen was never migrated, so the Receive view was dropped entirely.The Scan tab had the same bug silently:
VIEW_SCAN_QR_CODEwasn't catalogued, so the guard couldn't see it and it emitted a barescan_qr_codeevent.Both tabs now emit
screen.viewedwith{ screen_name, flow: "assets" }. Tests previously passed through both bugs because they mocktrack(); they now assert the event name and props.Refsthe Sentry issue rather thanFixes— resolving manually after prod verification.🤖 Generated with Claude Code