Prebid.js
Prebid.js copied to clipboard
Prebid Core Referer Detection: Allow for configurable referrer detection frequency
Type of change
- [x] Feature
Description of change
This PR introduces new logic to support configurable referrer detection frequency. New logic is as follows:
- By default referrer detection will occur only once
- Optionally, if the following is passed into the setConfig func, then the referrer frequency detection will be continuous:
pbjs.setConfig({refDetectionFreq: 'ongoing'});
Other information
Relates to https://github.com/prebid/Prebid.js/issues/8955 @dgirardi can you review?
I don't think we can go to default until 8, this broke some folks before
Hey @jlquaccia,
I'd prefer if we tried to optimize this without any configuration, I'm thinking of something like:
- on the first call, run the logic, cache the result and return it
- on subsequent calls:
- if we are on the top frame:
- check if
window.location.href
orgetCanonicalUrl
have changed since the last call. If they did, run the logic again and cache the result
- check if
- otherwise, run the logic again and cache the result
- return the cached result
- if we are on the top frame:
I expect Prebid to be living in the top frame quite often, and because in that case it's pretty easy to check whether the cache should be invalidated, I think this approach would get us most of the way to minimizing how often we run this logic.
Outside of the code conflicts, I agree with Patrick that the default behavior shouldn't be changed in a minor release. We should maintain behavior as it is today and if the prebid group decides to change the default behavior later, then that can be decided and agreed upon (if we're sure it won't break most setups). So then the config (if there will be one - see below), should be an opt-in to do the look-up once.
If not - then maybe this PR should just wait for the next major release in general.
To Demetrio's point, avoiding the config requirement can be good goal. I'm not sure if we can do that and also maintain existing behavior; maybe that can be part of the changes we do in a major release when we also change the default logic?
@jlquaccia - is this work still in progress, or do you mind if I pick it up?
@dgirardi - sorry for not following up on this one. sure, you can go ahead and pick this one up, have a bit on my plate over here at work at the moment anyway.
Closing this in favor of https://github.com/prebid/Prebid.js/pull/9670