-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Prebidmanager analytics adapter: fix console error when utm is null and collect page info #6002
Prebidmanager analytics adapter: fix console error when utm is null and collect page info #6002
Conversation
@@ -83,7 +83,7 @@ function collectUtmTagData() { | |||
if (newUtm === false) { | |||
utmTags.forEach(function (utmKey) { | |||
let itemValue = localStorage.getItem(`pm_${utmKey}`); | |||
if (itemValue.length !== 0) { | |||
if (itemValue !== null && typeof itemValue !== 'undefined' && itemValue.length !== 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very minor but simpler to just if (itemValue && itemValue.length !== 0) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edited this line. thank you.
pageInfo.referrerDomain = utils.parseUrl(document.referrer).hostname; | ||
} | ||
return pageInfo; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to add a unit test for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a test in test/spec/modules/prebidmanagerAnalyticsAdapter_spec.js
…nd collect page info (prebid#6002) * Fix PrebidManager analytics console error when utm data is null * collect pageInfo in PrebidManager analytics adapter * minor edit + add test for pageInfo in PrebidManager analytics adapter Co-authored-by: apuzanova <apuzanova@asteriosoft.com>
Type of change
Description of change
fix console error when utm data in local storage is null
prebid.js:3 Prebid ERROR: Prebid Manager Analytics: Error TypeError: Cannot read property 'length' of null
add collecting of page info (domain & referrer)