-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(rewards): add metrics #20521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(rewards): add metrics #20521
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
trackEvent( | ||
createEventBuilder(MetaMetricsEvents.REWARDS_REWARD_CLAIMED) | ||
.addProperties({ | ||
reward_id: rewardId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is likely not going to be useful, it's a uuid unique to our backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that’s the purpose, right? If we filter by this unique ID, we can retrieve how many times a specific reward was claimed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this reward is specific to the subscription. There will be at most one per subscription, leading to no meaningful data. You should instead look at the associated season reward.
app/components/UI/Rewards/components/Settings/RewardSettingsTabs.tsx
Outdated
Show resolved
Hide resolved
trackEvent( | ||
createEventBuilder(MetaMetricsEvents.REWARDS_ACTIVE_BOOST_CLICKED) | ||
.addProperties({ | ||
boost_id: boost.id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there value for metrics in having an ID referenced? These are mostly UUID's
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only to filter for specific boosts in MixPanel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the boost has the same issue as the rewards @jonson? re: https://github.com/MetaMask/metamask-mobile/pull/20521/files#r2389182208
app/components/UI/Rewards/components/Tabs/OverviewTab/WaysToEarn/WaysToEarn.tsx
Outdated
Show resolved
Hide resolved
@Brunonascdev A few events I'm not seeing that other features do have:
Also others we could track:
Once this PR has been rebased, there's also a few modals that we use that might be candidates for event tracking like:
|
app/components/UI/Rewards/components/Settings/RewardSettingsTabs.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Bruno, I left some comments. I'm not sure who has defined the currently suggested metrics but I left some proposals of events I think make sense. Could you check if they want to track them? Also you'll have to rebase your PR before doing any changes, as there have been quite a few changes recently. In general, we should be consistent when tracking actions; do we want to always log started/completed/failed/cancelled, ... And preferably those action metric tracking actions should live in the hooks.
…rewards-add-metrics
…sk-mobile into feat/rewards-add-metrics
…taMask/metamask-mobile into feat/rewards-add-metrics
|
Description
This PR adds metrics to the Rewards flows, following the approved mapping: https://consensyssoftware.atlassian.net/wiki/spaces/GL/pages/400218488856/Metrics+Mapping.
Changelog
CHANGELOG entry:
Related issues
Fixes:
Manual testing steps
Run the code locally with
IS_TEST
set tofalse
, and make sure metrics/marketing are enabled in the settings. You should then see events being triggered on the rewards screens in the terminal.Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Adds comprehensive metrics to Rewards views and actions (dashboard, onboarding, referrals, settings, rewards claim), new analytics enums/utilities, and user trait updates, plus minor param and test adjustments.
core/Analytics/MetaMetrics.events.ts
(viewed/clicked/started/completed/failed across flows).HAS_REWARDS_OPTED_IN
andREWARD_ENABLED_ACCOUNTS_COUNT
.RewardsDashboard.tsx
andRewardsReferralView.tsx
.RewardsSettingsView.tsx
.OnboardingIntroStep.tsx
andOnboardingStep3.tsx
.RewardsClaimBottomSheetModal.tsx
(now receivesseasonRewardId
fromRewardItem.tsx
).ActiveBoosts.tsx
and Ways to Earn CTA/button interactions inWaysToEarn.tsx
.ReferralDetails.tsx
.useOptIn.ts
: emit start/complete/fail events; include referral input type; setHAS_REWARDS_OPTED_IN
trait on success.useOptout.ts
: emit start/complete/fail events; set trait OFF on success; log cancel click.useLinkAccount.ts
: emit started/completed/failed events with derived account props.useRewardOptinSummary.ts
: update user trait with linked accounts count once per session.RewardsMetricsButtons
andderiveAccountMetricProps
inutils.ts
.seasonRewardId
), and selector/action import paths.useToAddressValidation
effect formatting.Written by Cursor Bugbot for commit 7d97b57. This will update automatically on new commits. Configure here.