Skip to content

fix(analytics): emit screen.viewed for the Scan/Receive tabs#951

Open
CassioMG wants to merge 2 commits into
mainfrom
fix/scan-receive-screen-viewed-analytics
Open

fix(analytics): emit screen.viewed for the Scan/Receive tabs#951
CassioMG wants to merge 2 commits into
mainfrom
fix/scan-receive-screen-viewed-analytics

Conversation

@CassioMG

@CassioMG CassioMG commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

What

ScanReceiveScreen now emits its per-tab screen views as screen.viewed (via getScreenViewedProps(), same as BottomSheet) instead of passing the VIEW_* slug to track() as an event name. Also adds the missing VIEW_SCAN_QR_CODE entry to SCREEN_CATALOG.

Why

Every view of the Receive tab logged:

[Analytics] Screen-view "view_public_key_generator" passed to track() directly; emit SCREEN_VIEWED via the navigation choke points instead. Event dropped.

Sample: https://stellarorg.sentry.io/issues/7633220935/

#944 added the unified screen firing track(VIEW_ACCOUNT_QR_CODE); #936 then made screen views a single screen.viewed event 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_CODE wasn't catalogued, so the guard couldn't see it and it emitted a bare scan_qr_code event.

Both tabs now emit screen.viewed with { screen_name, flow: "assets" }. Tests previously passed through both bugs because they mock track(); they now assert the event name and props.

Refs the Sentry issue rather than Fixes — resolving manually after prod verification.

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings July 26, 2026 15:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@CassioMG CassioMG self-assigned this Jul 26, 2026
@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown
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)

@CassioMG
CassioMG requested a review from piyalbasu July 27, 2026 12:46
@CassioMG

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>
@CassioMG

This comment was marked as resolved.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants