Skip to content

Commit 9ac62f6

Browse files
authored
fix: add user_first_touch_timestamp user attribute in _first_open event (#34)
1 parent ef4e5ed commit 9ac62f6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/provider/ClickstreamProvider.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export class ClickstreamProvider implements AnalyticsProvider {
8181
this.eventRecorder = new EventRecorder(this.context);
8282
this.globalAttributes = {};
8383
this.setGlobalAttributes(configuration.globalAttributes);
84-
84+
this.userAttributes = StorageUtil.getUserAttributes();
8585
this.sessionTracker = new SessionTracker(this, this.context);
8686
this.pageViewTracker = new PageViewTracker(this, this.context);
8787
this.clickTracker = new ClickTracker(this, this.context);
@@ -90,7 +90,6 @@ export class ClickstreamProvider implements AnalyticsProvider {
9090
this.pageViewTracker.setUp();
9191
this.clickTracker.setUp();
9292
this.scrollTracker.setUp();
93-
this.userAttributes = StorageUtil.getUserAttributes();
9493
if (configuration.sendMode === SendMode.Batch) {
9594
this.startTimer();
9695
}

test/ClickstreamAnalytics.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ describe('ClickstreamAnalytics test', () => {
6464
);
6565
const firstEvent = eventList[0];
6666
expect(firstEvent.event_type).toBe(Event.PresetEvent.FIRST_OPEN);
67+
expect(firstEvent.user[Event.ReservedAttribute.USER_FIRST_TOUCH_TIMESTAMP]).not.toBeUndefined()
6768
expect(firstEvent.attributes.brand).toBe('Samsung');
6869
expect(firstEvent.attributes.level).toBe(10);
6970
const testEvent = eventList[eventList.length - 1];

0 commit comments

Comments
 (0)