File tree Expand file tree Collapse file tree 4 files changed +10
-3
lines changed Expand file tree Collapse file tree 4 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import { AmplitudeSessionPlugin } from '@segment/analytics-react-native-plugin-a
30
30
const segmentClient = createClient ( {
31
31
writeKey : 'WRITE KEY' ,
32
32
trackAppLifecycleEvents : true ,
33
+ collectDeviceId : true ,
33
34
} ) ;
34
35
35
36
const LoggerPlugin = new Logger ( ) ;
Original file line number Diff line number Diff line change @@ -557,7 +557,8 @@ export class SegmentClient {
557
557
* Application Opened - the previously detected version is same as the current version
558
558
*/
559
559
private async checkInstalledVersion ( ) {
560
- const context = await getContext ( undefined ) ;
560
+ const context = await getContext ( undefined , this . config ) ;
561
+
561
562
const previousContext = this . store . context . get ( ) ;
562
563
563
564
this . store . context . set ( context ) ;
Original file line number Diff line number Diff line change @@ -8,8 +8,12 @@ import type {
8
8
UserTraits ,
9
9
} from './types' ;
10
10
11
+ interface GetContextConfig {
12
+ collectDeviceId ?: boolean ;
13
+ }
11
14
export const getContext = async (
12
- userTraits : UserTraits = { }
15
+ userTraits : UserTraits = { } ,
16
+ config : GetContextConfig = { }
13
17
) : Promise < Context > => {
14
18
const { AnalyticsReactNative } = NativeModules ;
15
19
@@ -31,7 +35,7 @@ export const getContext = async (
31
35
deviceId,
32
36
deviceType,
33
37
screenDensity,
34
- } : NativeContextInfo = await AnalyticsReactNative . getContextInfo ( { } ) ;
38
+ } : NativeContextInfo = await AnalyticsReactNative . getContextInfo ( config ) ;
35
39
36
40
const device : ContextDevice = {
37
41
id : deviceId ,
Original file line number Diff line number Diff line change @@ -123,6 +123,7 @@ export type Config = {
123
123
maxEventsToRetry ?: number ;
124
124
defaultSettings ?: SegmentAPISettings ;
125
125
autoAddSegmentDestination ?: boolean ;
126
+ collectDeviceId ?: boolean ;
126
127
} ;
127
128
128
129
export type ClientMethods = {
You can’t perform that action at this time.
0 commit comments