Skip to content

Commit 61ec879

Browse files
authored
Merge pull request #1953 from SUI-Components/send-ga4-event-always
feat(packages/sui-segment-wrapper): send always the ga4 init event
2 parents 2c42b7f + ceb8685 commit 61ec879

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/sui-segment-wrapper/src/segmentWrapper.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ const getTrackIntegrations = async ({gdprPrivacyValue, event}) => {
5757
let sessionId
5858
let clientId
5959

60-
if (isGdprAccepted) {
61-
try {
62-
;[marketingCloudVisitorId, sessionId] = await Promise.all([getAdobeMCVisitorID(), getGoogleSessionId()])
63-
64-
clientId = await getGoogleClientId()
65-
} catch (error) {
66-
console.error(error)
60+
try {
61+
if (isGdprAccepted) {
62+
marketingCloudVisitorId = await getAdobeMCVisitorID()
6763
}
64+
sessionId = await getGoogleSessionId()
65+
clientId = await getGoogleClientId()
66+
} catch (error) {
67+
console.error(error)
6868
}
6969

7070
const restOfIntegrations = getRestOfIntegrations({isGdprAccepted, event})

packages/sui-segment-wrapper/test/segmentWrapperSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ describe('Segment Wrapper', function () {
239239

240240
expect(context.integrations).to.deep.includes({
241241
fakeIntegrationKey: 'fakeIntegrationValue',
242-
'Google Analytics 4': true
242+
'Google Analytics 4': {clientId: 'fakeClientId', sessionId: 'fakeSessionId'}
243243
})
244244
})
245245

0 commit comments

Comments
 (0)