Skip to content

Commit e062224

Browse files
authored
feat/react-native-sdk-usage-marker (#47)
* feat: added marker for sdk analysis * feat: header approach
1 parent 3f09a3a commit e062224

5 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/analytics/api/events.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Platform } from 'react-native';
22
import type { DetourEvent } from '../types';
3+
import { SDK_HEADER_VALUE } from '../../version';
34

45
const EVENT_API_URL = 'https://godetour.dev/api/analytics/event';
56

@@ -21,6 +22,7 @@ export const sendEvent = async ({
2122
'Content-Type': 'application/json',
2223
'Authorization': `Bearer ${apiKey}`,
2324
'X-App-ID': appID,
25+
'X-SDK': SDK_HEADER_VALUE,
2426
},
2527
body: JSON.stringify({
2628
event_name: event.eventName,

src/analytics/api/retention.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Platform } from 'react-native';
2+
import { SDK_HEADER_VALUE } from '../../version';
23

34
const RETENTION_API_URL = 'https://godetour.dev/api/analytics/retention';
45

@@ -20,6 +21,7 @@ export const sendRetentionEvent = async ({
2021
'Content-Type': 'application/json',
2122
'Authorization': `Bearer ${apiKey}`,
2223
'X-App-ID': appID,
24+
'X-SDK': SDK_HEADER_VALUE,
2325
},
2426
body: JSON.stringify({
2527
event_name: eventName,

src/links/api/getDeferredLink.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { RequiredConfig } from '../types';
2+
import { SDK_HEADER_VALUE } from '../../version';
23
import {
34
getDeterministicFingerprint,
45
getProbabilisticFingerprint,
@@ -24,6 +25,7 @@ const sendFingerprint = async ({
2425
'Content-Type': 'application/json',
2526
'Authorization': `Bearer ${API_KEY}`,
2627
'X-App-ID': appID,
28+
'X-SDK': SDK_HEADER_VALUE,
2729
},
2830
body: JSON.stringify(requestBody),
2931
});

src/links/api/resolveShortLink.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { RequiredConfig } from '../types';
2+
import { SDK_HEADER_VALUE } from '../../version';
23

34
const API_URL = 'https://godetour.dev/api/link/resolve-short';
45

@@ -22,6 +23,7 @@ export const resolveShortLink = async ({
2223
'Content-Type': 'application/json',
2324
'Authorization': `Bearer ${API_KEY}`,
2425
'X-App-ID': appID,
26+
'X-SDK': SDK_HEADER_VALUE,
2527
},
2628
body: JSON.stringify({ url }),
2729
});

src/version.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { version } from '../package.json';
2+
3+
export const SDK_HEADER_VALUE = `react-native/${version}`;

0 commit comments

Comments
 (0)