-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(headless): send referrer as null when originLevel3 is default (#3974
) **Context** The server event schema was recently tightened to require document referrer to be a url if specified. The schema definition is available [here](https://github.com/coveo-platform/analytics_schema/blob/master/schemas/common/types.json#L289). Headless' behavior is to forward the originLevel3 value, which by default is set to the string `default`. This causes all server events sent by headless to be marked as invalid. **Approach** When the `analyticsMode` is `next` and originLevel3 is `default`, headless will send `null` instead of `default`.
- Loading branch information
1 parent
5f550d2
commit 42bc026
Showing
4 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/headless/src/features/configuration/analytics-params.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {buildMockAnalyticsState} from '../../test/mock-analytics-state'; | ||
import {fromAnalyticsStateToAnalyticsParams} from './analytics-params'; | ||
|
||
describe('fromAnalyticsStateToAnalyticsParams', () => { | ||
it('analyticsMode is next and originLevel3 is default, it sends documentReferrer as null', async () => { | ||
const analytics = buildMockAnalyticsState({ | ||
analyticsMode: 'next', | ||
originLevel3: 'default', | ||
}); | ||
const res = await fromAnalyticsStateToAnalyticsParams(analytics); | ||
expect(res.analytics?.documentReferrer).toBe(null); | ||
}); | ||
|
||
it('analyticsMode is legacy and originLevel3 is default, it sends documentReferrer as default', async () => { | ||
const analytics = buildMockAnalyticsState({ | ||
analyticsMode: 'legacy', | ||
originLevel3: 'default', | ||
}); | ||
const res = await fromAnalyticsStateToAnalyticsParams(analytics); | ||
expect(res.analytics?.documentReferrer).toBe('default'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters