Updated referrer attribution for empty history

- empty history means attribution script is not loaded, which should be only when its behind the flag
This commit is contained in:
Rishabh 2022-09-22 23:13:36 +05:30 committed by Rishabh Garg
parent eb7547ea3c
commit fe90dde0e1
2 changed files with 3 additions and 2 deletions

View File

@ -28,9 +28,10 @@ class ReferrerTranslator {
* @returns {ReferrerData|null}
*/
getReferrerDetails(history) {
// Empty history will return null as it means script is not loaded
if (history.length === 0) {
return {
refSource: 'Direct',
refSource: null,
refMedium: null,
refUrl: null
};

View File

@ -244,7 +244,7 @@ describe('ReferrerTranslator', function () {
it('returns null for empty history', async function () {
should(translator.getReferrerDetails([])).eql({
refSource: 'Direct',
refSource: null,
refMedium: null,
refUrl: null
});