Skip to content

Commit 1ea5062

Browse files
gunoooo박건우
andauthored
feat: add sourceType to event tracking (#27)
Co-authored-by: 박건우 <gunwoo@baggeon-uui-MacBookPro.local>
1 parent ec21441 commit 1ea5062

5 files changed

Lines changed: 16 additions & 7 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@clix-so/react-native-sdk",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"description": "Clix - Mobile push for builders",
55
"main": "./lib/module/index.js",
66
"types": "./lib/typescript/src/index.d.ts",

src/services/EventAPIService.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ export class EventAPIService {
1010
properties: Record<string, any>,
1111
messageId?: string,
1212
userJourneyId?: string,
13-
userJourneyNodeId?: string
13+
userJourneyNodeId?: string,
14+
sourceType?: string
1415
): Promise<void> {
1516
try {
1617
ClixLogger.debug(`Tracking event: ${name} for device: ${deviceId}`);
1718

1819
const eventRequestBody = {
1920
device_id: deviceId,
2021
name: name,
22+
...(sourceType && { source_type: sourceType }),
2123
event_property: {
2224
custom_properties: properties,
2325
...(messageId && { message_id: messageId }),

src/services/EventService.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export class EventService {
3030
properties?: Record<string, any>,
3131
messageId?: string,
3232
userJourneyId?: string,
33-
userJourneyNodeId?: string
33+
userJourneyNodeId?: string,
34+
sourceType?: string
3435
): Promise<void> {
3536
const deviceId = this.deviceService.getCurrentDeviceId();
3637

@@ -40,7 +41,8 @@ export class EventService {
4041
this.serializeProperties(properties),
4142
messageId,
4243
userJourneyId,
43-
userJourneyNodeId
44+
userJourneyNodeId,
45+
sourceType
4446
);
4547
}
4648
}

src/services/NotificationService.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ export class NotificationService {
422422
{},
423423
payload.messageId,
424424
payload.userJourneyId,
425-
payload.userJourneyNodeId
425+
payload.userJourneyNodeId,
426+
'CLIX'
426427
);
427428
ClixLogger.debug(
428429
'PUSH_NOTIFICATION_RECEIVED event tracked:',
@@ -446,7 +447,8 @@ export class NotificationService {
446447
{},
447448
payload.messageId,
448449
payload.userJourneyId,
449-
payload.userJourneyNodeId
450+
payload.userJourneyNodeId,
451+
'CLIX'
450452
);
451453
ClixLogger.debug(
452454
'PUSH_NOTIFICATION_TAPPED event tracked:',

src/services/SessionService.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ export class SessionService {
8585
await this.eventService.trackEvent(
8686
SessionEvent.SESSION_START,
8787
{},
88-
messageId
88+
messageId,
89+
undefined,
90+
undefined,
91+
'CLIX'
8992
);
9093
ClixLogger.debug(`${SessionEvent.SESSION_START} tracked`);
9194
} catch (error) {

0 commit comments

Comments
 (0)