From 4120120095f983a814fc8c79428284de8f3d8e38 Mon Sep 17 00:00:00 2001 From: Lucas Werey <73439207+LucasWerey@users.noreply.github.com> Date: Wed, 6 Nov 2024 12:18:10 +0100 Subject: [PATCH] :sparkles:(llm) add default analytics for deeplinks (#8295) --- .changeset/fuzzy-boxes-confess.md | 5 ++++ .../src/navigation/DeeplinksProvider.tsx | 23 +++++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 .changeset/fuzzy-boxes-confess.md diff --git a/.changeset/fuzzy-boxes-confess.md b/.changeset/fuzzy-boxes-confess.md new file mode 100644 index 000000000000..7763c2ee725f --- /dev/null +++ b/.changeset/fuzzy-boxes-confess.md @@ -0,0 +1,5 @@ +--- +"live-mobile": patch +--- + +Add default deeplink analytics diff --git a/apps/ledger-live-mobile/src/navigation/DeeplinksProvider.tsx b/apps/ledger-live-mobile/src/navigation/DeeplinksProvider.tsx index 41a84eda32a6..4605ef1d091b 100644 --- a/apps/ledger-live-mobile/src/navigation/DeeplinksProvider.tsx +++ b/apps/ledger-live-mobile/src/navigation/DeeplinksProvider.tsx @@ -13,11 +13,9 @@ import Config from "react-native-config"; import { useRemoteLiveAppContext } from "@ledgerhq/live-common/platform/providers/RemoteLiveAppProvider/index"; import { useFeature } from "@ledgerhq/live-common/featureFlags/index"; import { BUY_SELL_UI_APP_ID } from "@ledgerhq/live-common/wallet-api/constants"; - import Braze from "@braze/react-native-sdk"; import { LiveAppManifest } from "@ledgerhq/live-common/platform/types"; import * as Sentry from "@sentry/react-native"; - import { hasCompletedOnboardingSelector } from "~/reducers/settings"; import { navigationRef, isReadyRef } from "../rootnavigation"; import { ScreenName, NavigatorName } from "~/const"; @@ -29,8 +27,8 @@ import { track } from "~/analytics"; import { setEarnInfoModal } from "~/actions/earn"; import { blockPasswordLock } from "../actions/appstate"; import { useStorylyContext } from "~/components/StorylyStories/StorylyProvider"; - const routingInstrumentation = new Sentry.ReactNavigationInstrumentation(); +const TRACKING_EVENT = "deeplink_clicked"; const themes: { [key: string]: Theme; @@ -489,6 +487,12 @@ export const DeeplinksProvider = ({ currency, installApp, appName, + deeplinkSource, + deeplinkType, + deeplinkDestination, + deeplinkChannel, + deeplinkMedium, + deeplinkCampaign, } = query; if (!ajsPropSource && !Config.MOCK) { @@ -504,7 +508,7 @@ export const DeeplinksProvider = ({ // Track deeplink only when ajsPropSource attribute exists. if (ajsPropSource) { - track("deeplink_clicked", { + track(TRACKING_EVENT, { deeplinkSource: ajsPropSource, deeplinkCampaign: ajsPropCampaign, url: hostname, @@ -513,7 +517,16 @@ export const DeeplinksProvider = ({ appName, ...(ajsPropTrackData ? JSON.parse(ajsPropTrackData) : {}), }); - } + } else + track(TRACKING_EVENT, { + deeplinkSource, + deeplinkType, + deeplinkDestination, + deeplinkChannel, + deeplinkMedium, + deeplinkCampaign, + }); + const platform = pathname.split("/")[1]; if (isStorylyLink(url.toString())) {