diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 176143022428..062d49b771b8 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -1660,6 +1660,7 @@ const CONST = { CONTEXT_FULLSTORY: 'Fullstory', CONTEXT_POLICIES: 'Policies', TAG_ACTIVE_POLICY: 'active_policy_id', + TAG_NUDGE_MIGRATION_COHORT: 'nudge_migration_cohort', // Span names SPAN_OPEN_REPORT: 'ManualOpenReport', SPAN_APP_STARTUP: 'ManualAppStartup', diff --git a/src/libs/telemetry/TelemetrySynchronizer.ts b/src/libs/telemetry/TelemetrySynchronizer.ts index fa1a2aafa913..a8de074dd5d2 100644 --- a/src/libs/telemetry/TelemetrySynchronizer.ts +++ b/src/libs/telemetry/TelemetrySynchronizer.ts @@ -9,7 +9,7 @@ import Onyx from 'react-native-onyx'; import {getActivePolicies} from '@libs/PolicyUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import type {Policy, Session} from '@src/types/onyx'; +import type {Policy, Session, TryNewDot} from '@src/types/onyx'; /** * Connect to Onyx to retrieve information about the user's active policies. @@ -17,6 +17,7 @@ import type {Policy, Session} from '@src/types/onyx'; let session: OnyxEntry; let activePolicyID: OnyxEntry; let policies: OnyxCollection; +let tryNewDot: OnyxEntry; Onyx.connectWithoutView({ key: ONYXKEYS.NVP_ACTIVE_POLICY_ID, @@ -52,6 +53,14 @@ Onyx.connectWithoutView({ }, }); +Onyx.connectWithoutView({ + key: ONYXKEYS.NVP_TRY_NEW_DOT, + callback: (value) => { + tryNewDot = value; + sendTryNewDotCohortTag(); + }, +}); + function sendPoliciesContext() { if (!policies || !session?.email || !activePolicyID) { return; @@ -60,3 +69,11 @@ function sendPoliciesContext() { Sentry.setTag(CONST.TELEMETRY.TAG_ACTIVE_POLICY, activePolicyID); Sentry.setContext(CONST.TELEMETRY.CONTEXT_POLICIES, {activePolicyID, activePolicies}); } + +function sendTryNewDotCohortTag() { + const cohort = tryNewDot?.nudgeMigration?.cohort; + if (!cohort) { + return; + } + Sentry.setTag(CONST.TELEMETRY.TAG_NUDGE_MIGRATION_COHORT, cohort); +} diff --git a/src/types/onyx/TryNewDot.ts b/src/types/onyx/TryNewDot.ts index 21ebb2a3800a..ceb9232c8751 100644 --- a/src/types/onyx/TryNewDot.ts +++ b/src/types/onyx/TryNewDot.ts @@ -31,6 +31,8 @@ type TryNewDot = { nudgeMigration?: { /** Indicates timestamp of an action. */ timestamp: Date; + /** Indicates the user's cohort */ + cohort?: string; }; };