@datalyr/react-native 1.7.3 → 1.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,7 +12,6 @@ Mobile analytics and attribution SDK for React Native and Expo. Track events, id
12
12
  - [Custom Events](#custom-events)
13
13
  - [Screen Views](#screen-views)
14
14
  - [E-Commerce Events](#e-commerce-events)
15
- - [Revenue Events](#revenue-events)
16
15
  - [User Identity](#user-identity)
17
16
  - [Anonymous ID](#anonymous-id)
18
17
  - [Identifying Users](#identifying-users)
@@ -181,8 +180,7 @@ await Datalyr.initialize({
181
180
  interface AutoEventConfig {
182
181
  trackSessions?: boolean; // Track session_start / session_end (default: true)
183
182
  trackScreenViews?: boolean; // Enable screen view events via screen() (default: true)
184
- trackAppUpdates?: boolean; // Track app_update events (default: true)
185
- trackPerformance?: boolean; // Track performance metrics (default: false)
183
+ trackAppInstall?: boolean; // Track app_install on first open (default: true)
186
184
  sessionTimeoutMs?: number; // Session timeout in ms
187
185
  }
188
186
  ```
@@ -271,25 +269,7 @@ await Datalyr.trackAddPaymentInfo(true);
271
269
 
272
270
  ### Revenue Events
273
271
 
274
- > **Important:** If you use **Superwall** or **RevenueCat**, do not use `trackPurchase()`, `trackSubscription()`, or `trackRevenue()` for revenue attribution. These fire client-side before payment is confirmed, so trials and failed payments get counted as revenue. Use the [Superwall](https://docs.datalyr.com/integrations/superwall) or [RevenueCat](https://docs.datalyr.com/integrations/revenuecat) webhook integration for revenue events instead — they only fire when real money changes hands. Use the SDK for behavioral events only (`track('paywall_view')`, `track('trial_start')`, `screen()`, `identify()`, etc.).
275
-
276
- Track revenue with automatic SKAdNetwork encoding:
277
-
278
- ```typescript
279
- await Datalyr.trackRevenue('in_app_purchase', {
280
- value: 4.99,
281
- currency: 'USD',
282
- product_id: 'gems_500',
283
- });
284
- ```
285
-
286
- ### App Update Tracking
287
-
288
- Manually track version changes:
289
-
290
- ```typescript
291
- await Datalyr.trackAppUpdate('1.0.0', '1.1.0');
292
- ```
272
+ > **Important:** If you use **Superwall** or **RevenueCat**, do not track revenue client-side. Use the [Superwall](https://docs.datalyr.com/integrations/superwall) or [RevenueCat](https://docs.datalyr.com/integrations/revenuecat) webhook integration instead — they only fire when real money changes hands. Use the SDK for behavioral events only (`track('paywall_view')`, `track('trial_start')`, `screen()`, `identify()`, etc.).
293
273
 
294
274
  ---
295
275
 
@@ -636,10 +616,6 @@ await Datalyr.initialize({
636
616
  | Event | Trigger |
637
617
  |-------|---------|
638
618
  | `app_install` | First app open |
639
- | `app_open` | App launch |
640
- | `app_background` | App enters background |
641
- | `app_foreground` | App returns to foreground |
642
- | `app_update` | App version changes |
643
619
  | `session_start` | New session begins |
644
620
  | `session_end` | Session expires (30 min inactivity) |
645
621
 
@@ -1120,7 +1096,6 @@ All methods are static on the `Datalyr` class unless noted otherwise.
1120
1096
  | `trackWithSKAdNetwork(event, properties?)` | Track event with SKAN conversion value encoding |
1121
1097
  | `trackPurchase(value, currency?, productId?)` | Track a purchase |
1122
1098
  | `trackSubscription(value, currency?, plan?)` | Track a subscription |
1123
- | `trackRevenue(eventName, properties?)` | Track a revenue event |
1124
1099
  | `trackAddToCart(value, currency?, productId?, productName?)` | Track add-to-cart |
1125
1100
  | `trackViewContent(contentId?, contentName?, contentType?, value?, currency?)` | Track content view |
1126
1101
  | `trackInitiateCheckout(value, currency?, numItems?, productIds?)` | Track checkout start |
@@ -1128,7 +1103,6 @@ All methods are static on the `Datalyr` class unless noted otherwise.
1128
1103
  | `trackSearch(query, resultIds?)` | Track a search |
1129
1104
  | `trackLead(value?, currency?)` | Track a lead |
1130
1105
  | `trackAddPaymentInfo(success?)` | Track payment info added |
1131
- | `trackAppUpdate(previousVersion, currentVersion)` | Track an app version update |
1132
1106
 
1133
1107
  ### User Identity
1134
1108
 
@@ -1,5 +1,5 @@
1
1
  import { Platform, AppState } from 'react-native';
2
- import { getOrCreateVisitorId, getOrCreateAnonymousId, getOrCreateSessionId, createFingerprintData, generateUUID, getDeviceInfo, getNetworkType, validateEventName, validateEventData, debugLog, errorLog, Storage, STORAGE_KEYS, } from './utils';
2
+ import { getOrCreateVisitorId, getOrCreateAnonymousId, getOrCreateSessionId, createDeviceContext, generateUUID, getDeviceInfo, getNetworkType, validateEventName, validateEventData, debugLog, errorLog, Storage, STORAGE_KEYS, } from './utils';
3
3
  import { createHttpClient, HttpClient } from './http-client';
4
4
  import { createEventQueue, EventQueue } from './event-queue';
5
5
  import { attributionManager } from './attribution';
@@ -188,7 +188,7 @@ export class DatalyrSDK {
188
188
  const installData = await attributionManager.trackInstall();
189
189
  await this.track('app_install', {
190
190
  platform: Platform.OS === 'ios' || Platform.OS === 'android' ? Platform.OS : 'android',
191
- sdk_version: '1.7.2',
191
+ sdk_version: '1.7.5',
192
192
  ...installData,
193
193
  });
194
194
  }
@@ -874,7 +874,7 @@ export class DatalyrSDK {
874
874
  */
875
875
  async createEventPayload(eventName, eventData) {
876
876
  const deviceInfo = await getDeviceInfo();
877
- const fingerprintData = await createFingerprintData();
877
+ const deviceContext = await createDeviceContext();
878
878
  const attributionData = attributionManager.getAttributionData();
879
879
  // Get Apple Search Ads attribution if available
880
880
  const asaAttribution = appleSearchAdsIntegration.getAttributionData();
@@ -919,7 +919,7 @@ export class DatalyrSDK {
919
919
  carrier: deviceInfo.carrier,
920
920
  network_type: getNetworkType(),
921
921
  timestamp: Date.now(),
922
- sdk_version: '1.7.2',
922
+ sdk_version: '1.7.5',
923
923
  // Advertiser data (IDFA/GAID, ATT status) for server-side postback
924
924
  ...(advertiserInfo ? {
925
925
  idfa: advertiserInfo.idfa,
@@ -933,7 +933,7 @@ export class DatalyrSDK {
933
933
  // Apple Search Ads attribution
934
934
  ...asaData,
935
935
  },
936
- fingerprintData,
936
+ deviceContext,
937
937
  source: 'mobile_app',
938
938
  timestamp: new Date().toISOString(),
939
939
  };
@@ -149,11 +149,11 @@ export class HttpClient {
149
149
  ...payload.eventData,
150
150
  sessionId: payload.sessionId,
151
151
  source: payload.source || 'mobile_app',
152
- fingerprint: payload.fingerprintData,
152
+ fingerprint: payload.deviceContext,
153
153
  },
154
154
  context: {
155
155
  library: '@datalyr/react-native',
156
- version: '1.6.2',
156
+ version: '1.7.5',
157
157
  source: 'mobile_app',
158
158
  userProperties: payload.userProperties,
159
159
  },
package/lib/types.d.ts CHANGED
@@ -106,7 +106,7 @@ export interface EventData {
106
106
  app_build?: string;
107
107
  network_type?: string;
108
108
  }
109
- export interface FingerprintData {
109
+ export interface DeviceContext {
110
110
  deviceId?: string;
111
111
  deviceInfo?: {
112
112
  model: string;
@@ -127,7 +127,7 @@ export interface EventPayload {
127
127
  eventId: string;
128
128
  eventName: string;
129
129
  eventData?: EventData;
130
- fingerprintData?: FingerprintData;
130
+ deviceContext?: DeviceContext;
131
131
  source: 'mobile_app';
132
132
  timestamp: string;
133
133
  userId?: string;
package/lib/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import 'react-native-get-random-values';
2
- import { DeviceInfo as DeviceInfoType, FingerprintData } from './types';
2
+ import { DeviceInfo as DeviceInfoType, DeviceContext } from './types';
3
3
  export declare const STORAGE_KEYS: {
4
4
  VISITOR_ID: string;
5
5
  ANONYMOUS_ID: string;
@@ -45,9 +45,9 @@ export declare const getDeviceInfo: () => Promise<DeviceInfoType>;
45
45
  */
46
46
  export declare const clearDeviceInfoCache: () => void;
47
47
  /**
48
- * Create fingerprint data for attribution
48
+ * Create device context for attribution
49
49
  */
50
- export declare const createFingerprintData: () => Promise<FingerprintData>;
50
+ export declare const createDeviceContext: () => Promise<DeviceContext>;
51
51
  /**
52
52
  * Get network connection type
53
53
  */
package/lib/utils.js CHANGED
@@ -219,9 +219,9 @@ const fetchDeviceInfoInternal = async () => {
219
219
  }
220
220
  };
221
221
  /**
222
- * Create fingerprint data for attribution
222
+ * Create device context for attribution
223
223
  */
224
- export const createFingerprintData = async () => {
224
+ export const createDeviceContext = async () => {
225
225
  const deviceInfo = await getDeviceInfo();
226
226
  return {
227
227
  deviceId: deviceInfo.deviceId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalyr/react-native",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "description": "Datalyr SDK for React Native & Expo - Server-side attribution tracking for iOS and Android",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -16,7 +16,7 @@ import {
16
16
  getOrCreateVisitorId,
17
17
  getOrCreateAnonymousId,
18
18
  getOrCreateSessionId,
19
- createFingerprintData,
19
+ createDeviceContext,
20
20
  generateUUID,
21
21
  getDeviceInfo,
22
22
  getNetworkType,
@@ -209,7 +209,7 @@ export class DatalyrSDKExpo {
209
209
  const installData = await attributionManager.trackInstall();
210
210
  await this.track('app_install', {
211
211
  platform: Platform.OS,
212
- sdk_version: '1.7.2',
212
+ sdk_version: '1.7.5',
213
213
  sdk_variant: 'expo',
214
214
  ...installData,
215
215
  });
@@ -758,7 +758,7 @@ export class DatalyrSDKExpo {
758
758
 
759
759
  private async createEventPayload(eventName: string, eventData?: EventData): Promise<EventPayload> {
760
760
  const deviceInfo = await getDeviceInfo();
761
- const fingerprintData = await createFingerprintData();
761
+ const deviceContext = await createDeviceContext();
762
762
  const attributionData = attributionManager.getAttributionData();
763
763
  const networkType = getNetworkType();
764
764
 
@@ -805,7 +805,7 @@ export class DatalyrSDKExpo {
805
805
  carrier: deviceInfo.carrier,
806
806
  network_type: networkType,
807
807
  timestamp: Date.now(),
808
- sdk_version: '1.7.2',
808
+ sdk_version: '1.7.5',
809
809
  sdk_variant: 'expo',
810
810
  // Advertiser data (IDFA/GAID, ATT status) for server-side postback
811
811
  ...(advertiserInfo ? {
@@ -819,7 +819,7 @@ export class DatalyrSDKExpo {
819
819
  // Apple Search Ads attribution
820
820
  ...asaData,
821
821
  },
822
- fingerprintData,
822
+ deviceContext,
823
823
  source: 'mobile_app',
824
824
  timestamp: new Date().toISOString(),
825
825
  };
@@ -13,7 +13,7 @@ import {
13
13
  getOrCreateVisitorId,
14
14
  getOrCreateAnonymousId,
15
15
  getOrCreateSessionId,
16
- createFingerprintData,
16
+ createDeviceContext,
17
17
  generateUUID,
18
18
  getDeviceInfo,
19
19
  getNetworkType,
@@ -241,7 +241,7 @@ export class DatalyrSDK {
241
241
  const installData = await attributionManager.trackInstall();
242
242
  await this.track('app_install', {
243
243
  platform: Platform.OS === 'ios' || Platform.OS === 'android' ? Platform.OS : 'android',
244
- sdk_version: '1.7.2',
244
+ sdk_version: '1.7.5',
245
245
  ...installData,
246
246
  });
247
247
  }
@@ -1049,7 +1049,7 @@ export class DatalyrSDK {
1049
1049
  */
1050
1050
  private async createEventPayload(eventName: string, eventData?: EventData): Promise<EventPayload> {
1051
1051
  const deviceInfo = await getDeviceInfo();
1052
- const fingerprintData = await createFingerprintData();
1052
+ const deviceContext = await createDeviceContext();
1053
1053
  const attributionData = attributionManager.getAttributionData();
1054
1054
 
1055
1055
  // Get Apple Search Ads attribution if available
@@ -1097,7 +1097,7 @@ export class DatalyrSDK {
1097
1097
  carrier: deviceInfo.carrier,
1098
1098
  network_type: getNetworkType(),
1099
1099
  timestamp: Date.now(),
1100
- sdk_version: '1.7.2',
1100
+ sdk_version: '1.7.5',
1101
1101
  // Advertiser data (IDFA/GAID, ATT status) for server-side postback
1102
1102
  ...(advertiserInfo ? {
1103
1103
  idfa: advertiserInfo.idfa,
@@ -1111,7 +1111,7 @@ export class DatalyrSDK {
1111
1111
  // Apple Search Ads attribution
1112
1112
  ...asaData,
1113
1113
  },
1114
- fingerprintData,
1114
+ deviceContext,
1115
1115
  source: 'mobile_app',
1116
1116
  timestamp: new Date().toISOString(),
1117
1117
  };
package/src/expo.ts CHANGED
@@ -38,7 +38,7 @@ export {
38
38
  getOrCreateVisitorId,
39
39
  getOrCreateAnonymousId,
40
40
  getOrCreateSessionId,
41
- createFingerprintData,
41
+ createDeviceContext,
42
42
  getNetworkType,
43
43
  validateEventName,
44
44
  validateEventData,
@@ -194,11 +194,11 @@ export class HttpClient {
194
194
  ...payload.eventData,
195
195
  sessionId: payload.sessionId,
196
196
  source: payload.source || 'mobile_app',
197
- fingerprint: payload.fingerprintData,
197
+ fingerprint: payload.deviceContext,
198
198
  },
199
199
  context: {
200
200
  library: '@datalyr/react-native',
201
- version: '1.6.2',
201
+ version: '1.7.5',
202
202
  source: 'mobile_app',
203
203
  userProperties: payload.userProperties,
204
204
  },
package/src/types.ts CHANGED
@@ -133,7 +133,7 @@ export interface EventData {
133
133
  network_type?: string;
134
134
  }
135
135
 
136
- export interface FingerprintData {
136
+ export interface DeviceContext {
137
137
  deviceId?: string;
138
138
  deviceInfo?: {
139
139
  model: string;
@@ -155,7 +155,7 @@ export interface EventPayload {
155
155
  eventId: string;
156
156
  eventName: string;
157
157
  eventData?: EventData;
158
- fingerprintData?: FingerprintData;
158
+ deviceContext?: DeviceContext;
159
159
  source: 'mobile_app';
160
160
  timestamp: string;
161
161
  userId?: string;
package/src/utils-expo.ts CHANGED
@@ -224,8 +224,8 @@ export const getOrCreateSessionId = async (): Promise<string> => {
224
224
  }
225
225
  };
226
226
 
227
- // Fingerprint data creation using Expo APIs
228
- export const createFingerprintData = async () => {
227
+ // Device context creation using Expo APIs
228
+ export const createDeviceContext = async () => {
229
229
  try {
230
230
  const deviceInfo = await getDeviceInfo();
231
231
 
@@ -243,7 +243,7 @@ export const createFingerprintData = async () => {
243
243
  },
244
244
  };
245
245
  } catch (error) {
246
- errorLog('Error creating fingerprint data:', error as Error);
246
+ errorLog('Error creating device context:', error as Error);
247
247
  const deviceInfo = await getDeviceInfo();
248
248
  return {
249
249
  deviceId: deviceInfo.deviceId,
@@ -3,7 +3,7 @@
3
3
  * Both utils.ts and utils-expo.ts implement this interface
4
4
  */
5
5
 
6
- import { DeviceInfo, FingerprintData } from './types';
6
+ import { DeviceInfo, DeviceContext } from './types';
7
7
 
8
8
  export interface SDKUtils {
9
9
  STORAGE_KEYS: {
@@ -22,7 +22,7 @@ export interface SDKUtils {
22
22
  getOrCreateAnonymousId: () => Promise<string>;
23
23
  getOrCreateSessionId: () => Promise<string>;
24
24
  getDeviceInfo: () => Promise<DeviceInfo>;
25
- createFingerprintData: () => Promise<FingerprintData>;
25
+ createDeviceContext: () => Promise<DeviceContext>;
26
26
  getNetworkType: () => string | Promise<string>;
27
27
  validateEventName: (eventName: string) => boolean;
28
28
  validateEventData: (eventData: any) => boolean;
package/src/utils.ts CHANGED
@@ -11,7 +11,7 @@ try {
11
11
  import { v4 as uuidv4 } from 'uuid';
12
12
  import 'react-native-get-random-values'; // Required for uuid
13
13
 
14
- import { DeviceInfo as DeviceInfoType, FingerprintData } from './types';
14
+ import { DeviceInfo as DeviceInfoType, DeviceContext } from './types';
15
15
 
16
16
  // Storage Keys
17
17
  export const STORAGE_KEYS = {
@@ -250,9 +250,9 @@ const fetchDeviceInfoInternal = async (): Promise<DeviceInfoType> => {
250
250
  };
251
251
 
252
252
  /**
253
- * Create fingerprint data for attribution
253
+ * Create device context for attribution
254
254
  */
255
- export const createFingerprintData = async (): Promise<FingerprintData> => {
255
+ export const createDeviceContext = async (): Promise<DeviceContext> => {
256
256
  const deviceInfo = await getDeviceInfo();
257
257
 
258
258
  return {