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 new param in refererDetection to get top most referer #8294

Closed
robertrmartinez opened this issue Apr 18, 2022 · 3 comments
Closed

Add new param in refererDetection to get top most referer #8294

robertrmartinez opened this issue Apr 18, 2022 · 3 comments

Comments

@robertrmartinez
Copy link
Collaborator

Type of issue

Feature request

Description

Some adapters are implementing their own functions to get the top most referer.

See here for details and example: #8261

We should add this into the referer object passed into bid adapters so they do not have to duplicate this code!

@dgirardi
Copy link
Collaborator

dgirardi commented May 2, 2022

In what situation does it make sense to get the referrer to an iframe? isn't this just a bug with the current referrer detection?

Also related: #5637

@dgirardi
Copy link
Collaborator

dgirardi commented May 3, 2022

Dug a little more, and I think this is a bug that has become a feature. In the simple case where Prebid is not running in a cross-origin iframe, the referer is set to window.top.location:

foundReferrer = currentLocation;

There's no attempt to grab the actual referer as we do for iframes:

const referrer = previousWindow.document.referrer;

adapters are relying on this behavior - made especially clear by code that effectively says "get the current location from refererInfo, but don't expect it to contain the referrer":

function getUrl(refererInfo) {
if (refererInfo && refererInfo.referer) {
return refererInfo.referer;
}
try {
return getWindowTop.location.href;
} catch (e) {
return getWindowLocation.href;
}
}
function getReferrer() {
try {
return getWindowTop.document.referrer;
} catch (e) {
return document.referrer;
}
}

I'll try to address this with a breaking change for prebid 7 (#5637), but I'm not sure what we can do for 6 - I think most adapters are getting the wrong values if Prebid is running in an iframe.

@patmmccann
Copy link
Collaborator

tracking on #5637

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

3 participants