Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add url to each event #138

Merged
merged 2 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
perf: add window location url to all event submissions
  • Loading branch information
gtupak committed May 18, 2023
commit 5a536d618f2b5a0607478d3b135096d6a580b0a3
1 change: 1 addition & 0 deletions src/ArcxAnalyticsSdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ export class ArcxAnalyticsSdk {
this.socket.emit('submit-event', {
event,
attributes,
url: window.location.href,
})
}

Expand Down
6 changes: 6 additions & 0 deletions test/ArcxAnalyticsProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ describe('(int) ArcxAnalyticxProvider', () => {
elementId,
content,
},
url: TEST_JSDOM_URL,
}
}

Expand Down Expand Up @@ -208,6 +209,7 @@ describe('(int) ArcxAnalyticxProvider', () => {
expect(socketStub.emit).calledOnceWith('submit-event', {
event: 'test-event',
attributes: { gm: 'gm' },
url: TEST_JSDOM_URL,
})
})

Expand All @@ -219,6 +221,7 @@ describe('(int) ArcxAnalyticxProvider', () => {
attributes: {
url: '/test',
},
url: TEST_JSDOM_URL,
})
})

Expand All @@ -228,6 +231,7 @@ describe('(int) ArcxAnalyticxProvider', () => {
expect(socketStub.emit).calledOnceWith('submit-event', {
event: 'TRANSACTION_SUBMITTED',
attributes: { chain: 1, transaction_hash: '0x123', metadata: {} },
url: TEST_JSDOM_URL,
})
})

Expand All @@ -237,6 +241,7 @@ describe('(int) ArcxAnalyticxProvider', () => {
expect(socketStub.emit).calledOnceWith('submit-event', {
event: ATTRIBUTION_EVENT,
attributes: { source: 'facebook', medium: 'social', campaign: 'ad-camp' },
url: TEST_JSDOM_URL,
})
})

Expand All @@ -246,6 +251,7 @@ describe('(int) ArcxAnalyticxProvider', () => {
expect(socketStub.emit).calledOnceWith('submit-event', {
event: REFERRER_EVENT,
attributes: { referrer: '/test' },
url: TEST_JSDOM_URL,
})
})
})
Expand Down
1 change: 1 addition & 0 deletions test/ArcxAnalyticsSdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -994,5 +994,6 @@ function getAnalyticsData(event: string, attributes: any) {
return {
event,
attributes,
url: TEST_JSDOM_URL,
}
}
1 change: 1 addition & 0 deletions test/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export const TEST_UTM_CAMPAIGN = 'ad-camp'
export const TEST_UTM_MEDIUM = 'cpc'
export const TEST_UTM_CONTENT = 'ad-1'
export const TEST_REFERRER = 'https://arcx.money/'
// eslint-disable-next-line max-len
export const TEST_JSDOM_URL = `https://example.com/?utm_source=${TEST_UTM_SOURCE}&utm_medium=${TEST_UTM_MEDIUM}&utm_campaign=${TEST_UTM_CAMPAIGN}&utm_content=${TEST_UTM_CONTENT}`

export const TEST_API_KEY = '01234'
Expand Down