Files
trezor-suite/packages/analytics
Jan Václavík 9d37d98581 feat(suite): Refactor analytics
feat(suite): Divide analytics to relevant packages

refactor(suite): Split suite-common/analytics

fix(suite): Fix errors

fix(suite): Update codeowners

fix(suite): Fix undefined in event attributes

fix(suite): Fix suite-native tests

chore: split Services for Native vs Desktop

refactor(suite): Polish @suite-common/analytics

refactor(suite): Polish @suite/analytics and @suite-native/analytics

refactor(suite): Add analytics and legacyAnalytics to extraDependencies

refactor(suite): add useAnalytics and useLegacyAnalytics for desktop/native

refactor(suite): use analytics reporting in thunks

refactor(suite): fix naming and event type

refactor(suite): Refactor existing analytics reporting

refactor(suite): Refactor existing analytics reporting

refactor(suite): Refactor existing analytics reporting in actions

refactor(suite): Delete generate docs

refactor(suite): Fix analytics in middleware

refactor(suite): Refactor useLegacyAnalytics for suite native

fix(suite): Fix errors

fix(suite): Fix errors

fix(suite): Fix issues from code review

fix(suite): Fix side effect in guideActions

refactor(suite): Create getTypedNativeLegacyAnalytics and getTypedDesktopLegacyAnalytics

fix(suite): Fix type errors

refactor(suite): Extract types from suite-common/analytics to separated package

fix(suite): Fix bugs

fix: missing shared legacy analytics type in desktop analytics type

fix(suite): Fix errors

refactor(suite): Refactor useLegacyAnalytics and useAnalytics to new package structure

fix(suite): Fix depchecks

fix(suite): Fix yarnlock and depchecks

fix(suite): Update project refs

WIP

fix: desktop services typing from extra

WIP

# Conflicts:
#	packages/suite/src/hooks/suite/useLabelingCombined.ts
#	suite-native/app/src/navigation/AppTabNavigator.tsx

# Conflicts:
#	packages/suite-desktop-ui/package.json
#	packages/suite-desktop-ui/src/support/DesktopUpdater/EarlyAccessDisable.tsx
#	packages/suite-desktop-ui/src/support/DesktopUpdater/EarlyAccessEnable.tsx
#	packages/suite-desktop-ui/tsconfig.json
#	packages/suite/src/actions/suite/suiteActions.ts
#	packages/suite/src/components/connection/BluetoothConnectionModal.tsx
#	packages/suite/src/components/connection/CantSeeTrezorModal.tsx
#	packages/suite/src/components/connection/ConnectDeviceGlobalModal.tsx
#	packages/suite/src/components/guide/Feedback.tsx
#	packages/suite/src/components/guide/Guide.tsx
#	packages/suite/src/components/guide/SupportFeedbackSelection.tsx
#	packages/suite/src/components/suite/PrerequisitesGuide/DeviceConnect.tsx
#	packages/suite/src/components/suite/bluetooth/BluetoothDeviceListItem.tsx
#	packages/suite/src/components/suite/layouts/SuiteLayout/PageHeader/GlobalSendReceive/GlobalReceiveModal/GlobalReceiveModal.tsx
#	packages/suite/src/components/suite/layouts/SuiteLayout/PageHeader/GlobalSendReceive/GlobalSendReceiveButtons.tsx
#	packages/suite/src/components/suite/layouts/SuiteLayout/PageHeader/HeaderDropdown.tsx
#	packages/suite/src/components/suite/layouts/SuiteLayout/PageHeader/TradeActions.tsx
#	packages/suite/src/components/suite/modals/ReduxModal/ConfirmValueModal/ConfirmValueModal.tsx
#	packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewModalBodyInner.tsx
#	packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewModalBottomContent.tsx
#	packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/AddAccountModal/AddAccountButton/AddAccountButton.tsx
#	packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/AddTokenModal.tsx
#	packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ApproveModal.tsx
#	packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/AutoStartBeforeQuitModal.tsx
#	packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ClaimModal/ClaimModal.tsx
#	packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ConfirmUnverifiedModal.tsx
#	packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ConnectPermissionsModal.tsx
#	packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/MultiShareBackupModal/MultiShareBackupModal.tsx
#	packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/RevokeModal.tsx
#	packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/StellarManageTokenModal.tsx
#	packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/UnstakeModal/UnstakeForm/UnstakeButton.tsx
#	packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/UnstakeModal/UnstakeModal.tsx
#	packages/suite/src/components/wallet/WalletLayout/AccountBanners/StakingBanner.tsx
#	packages/suite/src/components/wallet/WalletLayout/AccountTopPanel/AccountNavigation.tsx
#	packages/suite/src/hooks/settings/backends/useBackendsForm.ts
#	packages/suite/src/hooks/suite/useChangeDeviceLabel.ts
#	packages/suite/src/hooks/wallet/trading/form/useTradingExchangeForm.ts
#	packages/suite/src/hooks/wallet/trading/form/useTradingSellForm.ts
#	packages/suite/src/views/dashboard/AssetsView/AssetCard/AssetCard.tsx
#	packages/suite/src/views/dashboard/AssetsView/AssetTable/AssetRow.tsx
#	packages/suite/src/views/dashboard/DashboardFooter.tsx
#	packages/suite/src/views/dashboard/StakingDashboard/StakingDashboardAccountRow.tsx
#	packages/suite/src/views/onboarding/steps/DeviceAuthenticityStep/SecurityCheck.tsx
#	packages/suite/src/views/settings/SettingsDevice/AutoLock.tsx
#	packages/suite/src/views/settings/SettingsDevice/Brightness.tsx
#	packages/suite/src/views/settings/SettingsDevice/ChangePin.tsx
#	packages/suite/src/views/settings/SettingsDevice/DisplayRotation.tsx
#	packages/suite/src/views/settings/SettingsDevice/ForgetDevice.tsx
#	packages/suite/src/views/settings/SettingsDevice/HapticFeedback.tsx
#	packages/suite/src/views/settings/SettingsDevice/MultiShareBackup.tsx
#	packages/suite/src/views/settings/SettingsDevice/Passphrase.tsx
#	packages/suite/src/views/settings/SettingsDevice/PinProtection.tsx
#	packages/suite/src/views/settings/SettingsDevice/ThpAutoconnect.tsx
#	packages/suite/src/views/settings/SettingsDevice/WipeCode.tsx
#	packages/suite/src/views/settings/SettingsDevice/WipeDevice/WipeDeviceModal.tsx
#	packages/suite/src/views/settings/SettingsGeneral/AddressDisplay.tsx
#	packages/suite/src/views/settings/SettingsGeneral/AutoEject.tsx
#	packages/suite/src/views/settings/SettingsGeneral/BaseCurrency.tsx
#	packages/suite/src/views/settings/SettingsGeneral/BioAuthSettings.tsx
#	packages/suite/src/views/settings/SettingsGeneral/DesktopSuiteBanner.tsx
#	packages/suite/src/views/settings/SettingsGeneral/Labeling.tsx
#	packages/suite/src/views/settings/SettingsGeneral/Language.tsx
#	packages/suite/src/views/settings/SettingsGeneral/MevProtection.tsx
#	packages/suite/src/views/settings/SettingsGeneral/NetworkReserve.tsx
#	packages/suite/src/views/settings/SettingsGeneral/Theme.tsx
#	packages/suite/src/views/settings/SettingsGeneral/TorOnionLinks.tsx
#	packages/suite/src/views/suite/SwitchDevice/DeviceItem/EjectConfirmation.tsx
#	packages/suite/src/views/suite/SwitchDevice/SwitchDevice.tsx
#	packages/suite/src/views/wallet/send/Outputs/Address.tsx
#	packages/suite/src/views/wallet/send/SendRaw.tsx
#	packages/suite/src/views/wallet/staking/components/StakingDashboard/components/ClaimCard.tsx
#	packages/suite/src/views/wallet/staking/components/StakingDashboard/components/EmptyStakingCard.tsx
#	packages/suite/src/views/wallet/staking/components/StakingDashboard/components/NewProviderCard.tsx
#	packages/suite/src/views/wallet/staking/components/StakingDashboard/components/StakingCard.tsx
#	packages/suite/src/views/wallet/tokens/TokensNavigation.tsx
#	packages/suite/src/views/wallet/tokens/common/TokensTable/TokenRow.tsx
#	packages/suite/src/views/wallet/trading/common/TradingDetail/TradingDetailBuy/TradingDetailBuy.tsx
#	packages/suite/src/views/wallet/trading/common/TradingDetail/TradingDetailExchange/TradingDetailExchange.tsx
#	packages/suite/src/views/wallet/trading/common/TradingDetail/TradingDetailSell/TradingDetailSell.tsx
#	packages/suite/src/views/wallet/trading/common/TradingForm/TradingFormApproval.tsx
#	packages/suite/src/views/wallet/trading/common/TradingLayout/TradingLayoutNavigation.tsx
#	packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferExchange/TradingOfferExchange.tsx
#	packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferSell/TradingOfferSellTransaction.tsx
#	packages/suite/src/views/wallet/transactions/TradeBox/TradeBox.tsx
#	packages/suite/src/views/wallet/transactions/TransactionList/TransactionListActions/ExportAction.tsx
#	packages/suite/src/views/wallet/transactions/components/AccountEmpty.tsx
#	suite/e2e/package.json
#	suite/e2e/tsconfig.json
#	yarn.lock
2026-01-17 21:10:25 +01:00
..
2026-01-17 21:10:25 +01:00
2025-05-05 13:51:36 +02:00

@trezor/analytics

This is a generic analytics package. To use analytics in a specific environment, please use one of the following packages or create a new one inspired by existing ones.

Keep in mind that global fetch and URLSearchParams methods must be available. Node and React Native use polyfills as a substitute.

Tracking process

Data about interactions are transferred in GET HTTPS requests encoded in URI.

List of available configured endpoints:

https://data.trezor.io    /suite    /log    /desktop   /develop     .log
https://data.trezor.io    /suite    /log    /desktop   /stable      .log
https://data.trezor.io    /suite    /log    /web       /develop     .log
https://data.trezor.io    /suite    /log    /web       /stable      .log

Example URI:

https://data.trezor.io/suite/log/web/stable.log?c_v=1.8&c_type=transport-type&c_commit=4d09d88476dab2e6b2fbfb833b749e9ac62251c2&c_instance_id=qlT0xL2XKV&c_session_id=FZjilOYQic&c_timestamp=1624893047903&type=bridge&version=22.10.1

Which tracks:

{
  c_v: '22.10.1',
  c_type: 'transport-type',
  c_commit: '4d09d88476dab2e6b2fbfb833b749e9ac62251c2',
  c_instance_id: 'qlT0xL2XKV',
  c_session_id: 'FZjilOYQic',
  c_timestamp: 1624893047903,
  type: 'BridgeTransport',
  version: '2.0.30'
}

Attributes which are always tracked:

  • c_v: version of analytics
  • c_type: type of tracked event
  • c_commit: current revision of app
  • c_instance_id: until user wipes storage, the ID does not change
  • c_session_id: ID changing on every launch of app
  • c_timestamp: time in ms when event is created (added in 1.11)

Other attributes are connected to a specific event type.