Skip to content

Add Amplitude analytics to contest UI#14283

Open
dylanjeffers wants to merge 1 commit intomainfrom
dylan/contest-analytics
Open

Add Amplitude analytics to contest UI#14283
dylanjeffers wants to merge 1 commit intomainfrom
dylan/contest-analytics

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

Adds Amplitude tracking for three key contest interactions, following the existing Remix Contest: event prefix and { remixContestId, trackId } property shape used by the host / pick-winners events.

Event Fires when
REMIX_CONTEST_VIEW (Remix Contest: View) Contest page/screen first resolves both trackId and eventId. Ref-guarded so re-renders (followers count, scroll-y reactions) don't re-fire.
REMIX_CONTEST_ENTER (Remix Contest: Enter) User taps the Enter Contest / Upload Remix button. Wraps the existing useEnterContest callback so the upload flow itself is unchanged.
REMIX_CONTEST_VIEW_SUBMISSIONS (Remix Contest: View Submissions) User opens the submissions tab.

Files

  • packages/common/src/models/Analytics.ts — three new Name enum entries, three matching event-property types, and three union additions.
  • packages/web/src/pages/contest-page/components/desktop/ContestPage.tsx — view effect, wrapped enter handler, submissions-pill onClick event.
  • packages/mobile/src/screens/contest-screen/ContestScreen.tsx — view effect + wrapped enter handler.
  • packages/mobile/src/screens/contest-screen/tabs/ContestSubmissionsTab.tsx — submissions-tab focus event.

Notes

  • Mobile submissions firing uses useFocusedTab from react-native-collapsible-tab-view. The contest tab navigator runs with lazy: false, so a plain mount effect would fire even for users who only ever look at the Details tab.
  • The ENTER event fires on click intent — i.e. before useRequiresAccountCallback redirects unauthenticated users to sign-in. This matches typical click-tracking semantics; switch to firing inside the gate if we want completion-only.

Test plan

  • npm run typecheck passes (verified locally on @audius/common, @audius/web, @audius/mobile)
  • Web: open a contest page → check Amplitude debug logs for one Remix Contest: View. Click Enter Contest → one Remix Contest: Enter. Click Submissions tab → one Remix Contest: View Submissions (and only one when toggling back and forth).
  • Mobile: navigate to a contest screen → one Remix Contest: View. Tap Enter Contest → one Remix Contest: Enter. Swipe/tap to Submissions → one Remix Contest: View Submissions; swipe back and forth shouldn't re-fire.
  • Confirm remixContestId + trackId payloads land in Amplitude alongside the existing remix-contest events.

🤖 Generated with Claude Code

Instruments three key contest interactions following the existing
'Remix Contest:' event prefix and {remixContestId, trackId} property
shape used by the host/pick-winners events:

  - REMIX_CONTEST_VIEW: contest page/screen first resolves trackId+eventId
  - REMIX_CONTEST_ENTER: user taps Enter Contest / Upload Remix
  - REMIX_CONTEST_VIEW_SUBMISSIONS: user opens the submissions tab

Mobile submissions-tab firing uses useFocusedTab from
react-native-collapsible-tab-view because the contest tabs mount
eagerly (lazy: false) — a plain mount effect would fire even for
users who only view the Details tab.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 8, 2026

⚠️ No Changeset found

Latest commit: 81d5fdb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant