Skip to content

Commit 9773647

Browse files
committed
Update rewards metametrics
1 parent 1f1806a commit 9773647

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

app/scripts/metamask-controller.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3297,6 +3297,9 @@ export default class MetamaskController extends EventEmitter {
32973297
metaMetricsController,
32983298
),
32993299
trackInsightSnapView: this.trackInsightSnapView.bind(this),
3300+
updateMetaMetricsTraits: metaMetricsController.updateTraits.bind(
3301+
metaMetricsController,
3302+
),
33003303

33013304
// MetaMetrics buffering for onboarding
33023305
addEventBeforeMetricsOptIn:

shared/constants/metametrics.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,24 @@ export type MetaMetricsUserTraits = {
541541
// TODO: Fix in https://github.com/MetaMask/metamask-extension/issues/31860
542542
// eslint-disable-next-line @typescript-eslint/naming-convention
543543
profile_id?: string;
544+
/**
545+
* Whether the user has opted into Rewards.
546+
*/
547+
// TODO: Fix in https://github.com/MetaMask/metamask-extension/issues/31860
548+
// eslint-disable-next-line @typescript-eslint/naming-convention
549+
has_rewards_opted_in?: string;
550+
/**
551+
* Whether the user was referred when opting into Rewards.
552+
*/
553+
// TODO: Fix in https://github.com/MetaMask/metamask-extension/issues/31860
554+
// eslint-disable-next-line @typescript-eslint/naming-convention
555+
rewards_referred?: boolean;
556+
/**
557+
* The referral code used when opting into Rewards.
558+
*/
559+
// TODO: Fix in https://github.com/MetaMask/metamask-extension/issues/31860
560+
// eslint-disable-next-line @typescript-eslint/naming-convention
561+
rewards_referral_code_used?: string;
544562
};
545563

546564
export enum MetaMetricsUserTrait {
@@ -647,6 +665,12 @@ export enum MetaMetricsUserTrait {
647665
* Identified when the user adds or removes configured chains (evm or non-evm)
648666
*/
649667
ChainIdList = 'chain_id_list',
668+
/**
669+
* Rewards-specific traits
670+
*/
671+
HasRewardsOptedIn = 'has_rewards_opted_in',
672+
RewardsReferred = 'rewards_referred',
673+
RewardsReferralCodeUsed = 'rewards_referral_code_used',
650674
}
651675

652676
/**
@@ -942,6 +966,13 @@ export enum MetaMetricsEventName {
942966
// Extension Port Stream
943967
PortStreamChunked = 'Port Stream Chunked',
944968
ViewportSwitched = 'Viewport Switched',
969+
// Rewards
970+
RewardsOptInStarted = 'REWARDS_OPT_IN_STARTED',
971+
RewardsOptInFailed = 'REWARDS_OPT_IN_FAILED',
972+
RewardsOptInCompleted = 'REWARDS_OPT_IN_COMPLETED',
973+
RewardsAccountLinkingStarted = 'REWARDS_ACCOUNT_LINKING_STARTED',
974+
RewardsAccountLinkingCompleted = 'REWARDS_ACCOUNT_LINKING_COMPLETED',
975+
RewardsAccountLinkingFailed = 'REWARDS_ACCOUNT_LINKING_FAILED',
945976
// Shield
946977
ShieldEntryModal = 'Shield Entry Modal',
947978
ShieldSubscriptionRequest = 'Shield Subscription Request',
@@ -1022,6 +1053,7 @@ export enum MetaMetricsEventCategory {
10221053
Confirmations = 'Confirmations',
10231054
CrossChainSwaps = 'Cross Chain Swaps',
10241055
PortStream = 'Port Stream',
1056+
Rewards = 'Rewards',
10251057
Shield = 'Shield',
10261058
}
10271059

0 commit comments

Comments
 (0)