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

Prebid custom key bug fix #6734

Closed
patrickloughrey opened this issue May 10, 2021 · 4 comments
Closed

Prebid custom key bug fix #6734

patrickloughrey opened this issue May 10, 2021 · 4 comments
Assignees
Labels

Comments

@patrickloughrey
Copy link
Contributor

patrickloughrey commented May 10, 2021

Type of issue

Bug Fix

Description

I have noticed a potential Prebid core bug when troubleshooting one of our publishers' pages. I am implementing Prebid custom keys via pbjs.bidderSettings defined here: https://docs.prebid.org/dev-docs/publisher-api-reference.html#module_pbjs.bidderSettings

The issue that I am seeing is that when explicitly defining these custom keys via pbjs.bidderSettings.adServerTargeting I am seeing both the custom keys and the Prebid default keys being sent to Google Ad Manager in the ad server request. The Prebid default keys should not be sent since the sendStandardTargeting flag is set to false. Here is a screenshot of the ad server request within a test page environment:
Screen Shot 2021-05-10 at 3 16 21 PM

The code used to implement the custom keys is the following:

pbjs.bidderSettings = {
    improvedigital: {
         sendStandardTargeting: false,
         adserverTargeting: [
            {
               key: "hb_pb_id",
               val: function(bidResponse) {
                   return bidResponse.pbMg;
               }
            }, {
               key: "hb_size_id",
               val: function(bidResponse) {
                   return bidResponse.size;
               }
            }, {
               key: "hb_adid_id",
               val: function(bidResponse) {
                   return bidResponse.adId;
               }
            }, {
               key: "hb_uuid_id",
               val: function(bidResponse) {
                   return bidResponse.videoCacheKey;
               }
            }
         ]
     },
     rubicon: {
         sendStandardTargeting: false,
         adserverTargeting: [
            {
               key: "hb_pb_rubi",
               val: function(bidResponse) {
                   return bidResponse.pbMg;
               }
            }, {
               key: "hb_size_rubi",
               val: function(bidResponse) {
                   return bidResponse.size;
               }
            }, {
               key: "hb_adid_rubi",
               val: function(bidResponse) {
                   return bidResponse.adId;
               }
            }, {
               key: "hb_uuid_rubi",
               val: function(bidResponse) {
                   return bidResponse.videoCacheKey;
               }
            }
         ]
     },
    '33across': {
         sendStandardTargeting: false,
         adserverTargeting: [
            {
               key: "hb_pb_33a",
               val: function(bidResponse) {
                   return bidResponse.pbMg;
               }
            }, {
               key: "hb_size_33a",
               val: function(bidResponse) {
                   return bidResponse.size;
               }
            }, {
               key: "hb_adid_33a",
               val: function(bidResponse) {
                   return bidResponse.adId;
               }
            }, {
               key: "hb_uuid_33a",
               val: function(bidResponse) {
                   return bidResponse.videoCacheKey;
               }
            }
         ]
     }
}

I have verified that pbjs.bidderSettings is successfully updated and reflected on the page with the sendStandardTargeting flag set to false:
Screen Shot 2021-05-10 at 3 37 44 PM

Steps to reproduce

This bug can be reproduced using the following test page:

prebid-bug.zip

You can serve this test page up with any server. In order to see Prebid key values sent to the ad server, a bid spoofing mechanism will have to be used in conjunction.

@ChrisHuie ChrisHuie self-assigned this May 12, 2021
@ChrisHuie ChrisHuie removed their assignment May 24, 2021
@ChrisHuie ChrisHuie added the bug label Aug 2, 2021
@dgirardi dgirardi self-assigned this Nov 17, 2021
@dgirardi
Copy link
Collaborator

The issue is that "landscape" targeting keys (those suffixed with _<bidder> generated with enableSendAllTargeting) do not look at bidderSettings. It's not right, but it's also not immediately clear how they should interact.

Prebid.js/src/targeting.js

Lines 597 to 618 in c86d069

function getBidLandscapeTargeting(adUnitCodes, bidsReceived) {
const standardKeys = TARGETING_KEYS.concat(NATIVE_TARGETING_KEYS);
const adUnitBidLimit = config.getConfig('sendBidsControl.bidLimit');
const bids = getHighestCpmBidsFromBidPool(bidsReceived, getHighestCpm, adUnitBidLimit);
const allowSendAllBidsTargetingKeys = config.getConfig('targetingControls.allowSendAllBidsTargetingKeys');
const allowedSendAllBidTargeting = allowSendAllBidsTargetingKeys
? allowSendAllBidsTargetingKeys.map((key) => CONSTANTS.TARGETING_KEYS[key])
: standardKeys;
// populate targeting keys for the remaining bids
return bids.map(bid => {
if (bidShouldBeAddedToTargeting(bid, adUnitCodes)) {
return {
[bid.adUnitCode]: getTargetingMap(bid, standardKeys.filter(
key => typeof bid.adserverTargeting[key] !== 'undefined' &&
allowedSendAllBidTargeting.indexOf(key) !== -1)
)
};
}
}).filter(bid => bid); // removes empty elements in array
}

@dgirardi
Copy link
Collaborator

dgirardi commented Mar 8, 2022

@bretg this is an example of a "breaking fix": in #8130 the proposal is to do as this issue suggests, remove standard bidder KVPs if sendStandardTargeting === false. But we may have publishers that are relying on the current behavior.

Should we introduce a new setting as a stopgap (maybe sendAllBidsStandardTargeting), or wait until we redo KVPs?

@dgirardi dgirardi moved this to Ready for Dev in Prebid.js Tactical Issues table Mar 8, 2022
@dgirardi dgirardi moved this from Ready for Dev to Blocked in Prebid.js Tactical Issues table Mar 8, 2022
@dgirardi dgirardi moved this from Blocked to Ready for Dev in Prebid.js Tactical Issues table Mar 8, 2022
@bretg
Copy link
Collaborator

bretg commented Mar 8, 2022

This was originally opened by a Magniter, but I haven't heard internal conversation calling out this as a high priority issue.

So unless someone else disagrees, I'm ok tying this to the KVP control refactoring planned in #8130

@dgirardi dgirardi moved this from Current to Backlog in Prebid.js Tactical Issues table Mar 8, 2022
@dgirardi dgirardi moved this from Backlog to Current in Prebid.js Tactical Issues table Mar 8, 2022
@dgirardi dgirardi moved this from Open to Blocked in Prebid.js Tactical Issues table Mar 9, 2022
@bretg
Copy link
Collaborator

bretg commented Mar 15, 2022

closing this -- will be resolved with #8130

@bretg bretg closed this as completed Mar 15, 2022
Repository owner moved this from Blocked to Done in Prebid.js Tactical Issues table Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

4 participants