Skip to content

Commit

Permalink
fix: add user_first_touch_timestamp user attribute in _first_open eve…
Browse files Browse the repository at this point in the history
…nt (#34)
  • Loading branch information
zhu-xiaowei authored Dec 5, 2023
1 parent ef4e5ed commit 9ac62f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/provider/ClickstreamProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class ClickstreamProvider implements AnalyticsProvider {
this.eventRecorder = new EventRecorder(this.context);
this.globalAttributes = {};
this.setGlobalAttributes(configuration.globalAttributes);

this.userAttributes = StorageUtil.getUserAttributes();
this.sessionTracker = new SessionTracker(this, this.context);
this.pageViewTracker = new PageViewTracker(this, this.context);
this.clickTracker = new ClickTracker(this, this.context);
Expand All @@ -90,7 +90,6 @@ export class ClickstreamProvider implements AnalyticsProvider {
this.pageViewTracker.setUp();
this.clickTracker.setUp();
this.scrollTracker.setUp();
this.userAttributes = StorageUtil.getUserAttributes();
if (configuration.sendMode === SendMode.Batch) {
this.startTimer();
}
Expand Down
1 change: 1 addition & 0 deletions test/ClickstreamAnalytics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ describe('ClickstreamAnalytics test', () => {
);
const firstEvent = eventList[0];
expect(firstEvent.event_type).toBe(Event.PresetEvent.FIRST_OPEN);
expect(firstEvent.user[Event.ReservedAttribute.USER_FIRST_TOUCH_TIMESTAMP]).not.toBeUndefined()
expect(firstEvent.attributes.brand).toBe('Samsung');
expect(firstEvent.attributes.level).toBe(10);
const testEvent = eventList[eventList.length - 1];
Expand Down

0 comments on commit 9ac62f6

Please sign in to comment.