From 55230414b81d6ca7850799fdb0a91ab4f9b6d56c Mon Sep 17 00:00:00 2001 From: Sebastian Klingler Date: Fri, 2 Jun 2023 16:55:06 -0500 Subject: [PATCH] Add clientVersion to mobile analytics (#3498) --- packages/mobile/src/services/analytics.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/mobile/src/services/analytics.ts b/packages/mobile/src/services/analytics.ts index 635171e3b34..0a33ac4a5ad 100644 --- a/packages/mobile/src/services/analytics.ts +++ b/packages/mobile/src/services/analytics.ts @@ -4,9 +4,12 @@ import VersionNumber from 'react-native-version-number' import { versionInfo } from 'app/utils/appVersionWithCodepush' +import packageInfo from '../../package.json' import type { Track, Screen, AllEvents } from '../types/analytics' import { EventNames } from '../types/analytics' +const { version: clientVersion } = packageInfo + let analyticsSetupStatus: 'ready' | 'pending' | 'error' = 'pending' const AmplitudeWriteKey = Config.AMPLITUDE_WRITE_KEY @@ -76,6 +79,7 @@ export const track = async ({ eventName, properties }: Track) => { const version = VersionNumber.appVersion const propertiesWithContext = { ...properties, + clientVersion, mobileClientVersion: version, mobileClientVersionInclOTA: versionInfo ?? 'unknown' }