Skip to content

Commit

Permalink
feat: ptx mixpanel attributes (#7106)
Browse files Browse the repository at this point in the history
* feat: tracking ptx analytics attributes

* feat: changeset

* feat: rename
  • Loading branch information
cng-ledger authored Jun 17, 2024
1 parent c62debe commit aab1636
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-pumas-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": minor
---

feat: tracking ptx analytics attributes
24 changes: 11 additions & 13 deletions apps/ledger-live-desktop/src/renderer/analytics/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ const getPtxAttributes = () => {
const stakingProviders = analyticsFeatureFlagMethod("ethStakingProviders");
const ptxSwapMoonpayProviderFlag = analyticsFeatureFlagMethod("ptxSwapMoonpayProvider");

const ptxSwapLiveAppDemoZero = analyticsFeatureFlagMethod("ptxSwapLiveAppDemoZero")?.enabled;
const ptxSwapLiveAppDemoOne = analyticsFeatureFlagMethod("ptxSwapLiveAppDemoOne")?.enabled;
const ptxSwapThorswapProvider = analyticsFeatureFlagMethod("ptxSwapThorswapProvider")?.enabled;
const ptxSwapExodusProvider = analyticsFeatureFlagMethod("ptxSwapExodusProvider")?.enabled;

const isBatch1Enabled: boolean =
!!fetchAdditionalCoins?.enabled && fetchAdditionalCoins?.params?.batch === 1;
const isBatch2Enabled: boolean =
Expand All @@ -91,6 +96,10 @@ const getPtxAttributes = () => {
isBatch3Enabled,
stakingProvidersEnabled,
ptxSwapMoonpayProviderEnabled,
ptxSwapLiveAppDemoZero,
ptxSwapLiveAppDemoOne,
ptxSwapThorswapProvider,
ptxSwapExodusProvider,
};
};

Expand Down Expand Up @@ -118,14 +127,7 @@ const extraProperties = (store: ReduxStore) => {
const device = lastSeenDeviceSelector(state);
const devices = devicesModelListSelector(state);
const accounts = accountsSelector(state);

const {
isBatch1Enabled,
isBatch2Enabled,
isBatch3Enabled,
stakingProvidersEnabled,
ptxSwapMoonpayProviderEnabled,
} = getPtxAttributes();
const ptxAttributes = getPtxAttributes();

const deviceInfo = device
? {
Expand Down Expand Up @@ -178,11 +180,7 @@ const extraProperties = (store: ReduxStore) => {
hasInfinityPass,
hasSeenMarketWidget: getMarketWidgetAnalytics(),
modelIdList: devices,
stakingProvidersEnabled,
isBatch1Enabled,
isBatch2Enabled,
isBatch3Enabled,
ptxSwapMoonpayProviderEnabled,
...ptxAttributes,
...deviceInfo,
};
};
Expand Down

0 comments on commit aab1636

Please sign in to comment.