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

Cannot set KVP per bidder and preserve hb_pb for winner #196

Closed
CarsonBanov opened this issue Feb 16, 2016 · 5 comments
Closed

Cannot set KVP per bidder and preserve hb_pb for winner #196

CarsonBanov opened this issue Feb 16, 2016 · 5 comments
Assignees
Labels

Comments

@CarsonBanov
Copy link
Contributor

My desire:
In an effort to set up some bid analytics, I would like to set up the KVP for each partner such that:

  • each partner regardless if they win or lose sets a KVP of their bid (ex: appnexus_bid: 1.00)
  • the "standard" bidder settings should still be used for the winning bidder because our line items are set up to work with hb_pb

Attempts thru Prebid:
To start, the standard.adserverTargeting array is set to be exactly the defaults. Then I tried:

  • add appnexus.adserverTargeting array which includes one element of appnexus_bid. This doesn't work because only the appnexus_bid KVP will be set and hb_pb is never set
  • add appnexus.adserverTargeting array which includes all the elements of standard.adserverTargeting plus one additional element of appnexus_bid. This is better since hb_pb will be set, but it doesn't work because these KVP are only set when appnexus wins!
  • add appnexus.adserverTargeting array which includes all the elements of standard.adserverTargeting plus one additional element of appnexus_bid and set alwaysUseBid: true. This is close as well since for all bidders they will set appnexus_bid, brealtime_bid, etc., BUT the hb_pb value will always be set by the last partner that runs. That means that although I get the per-partner bid KVP's, the hb_pb value will not represent the winning bid!

Solutions:

  • When alwaysUseBid is used, set the KVP for that partner appnexus.adserverTargeting always but set the KVP for standard.adserverTargeting only for the winner
  • Allow alwaysUseBid to somehow apply to an individual KVP
  • Implement a new function bidKvpAdjustment similar to bidCpmAdjustment that can be optionally implemented for each partner that is called with bidResponse (not just bidCpm) and responds with a KVP to be set

The attempts and solutions I came up with are based on my non-expert understanding of the Prebid code. If there is another way to do what I want (set custom KVPs for each partner but preserve standard KVPs to be set by the winning partner) then please let me know. If this feature requires a code change, I can make a PR, but I don't know what the best route is.

Thanks for your time.

@CarsonBanov
Copy link
Contributor Author

Related:
similar issue and corresponding code change

@CarsonBanov
Copy link
Contributor Author

@mkendall07 If you let me know which path to go down I can try to do the coding 😄 (or perhaps there's a way to do it with no code changes)
Don't mean to be the squeaky wheel! Thanks

@mkendall07
Copy link
Member

@CarsonBanov
Thanks for the report and detailed analysis. I think approach #1 is the way to go, in fact I think the existing behavior is most likely incorrect. I would expect the winning bid to still be set for the default settings. I will take a look at the code and see what is going on.

@mkendall07 mkendall07 added the bug label Feb 18, 2016
@CarsonBanov
Copy link
Contributor Author

Thanks so much for taking a look at it!

Thoughts:
Looks like in prebid.js in buildBidResponse we do:

// add the bid if alwaysUse and bid has returned
if (bid.alwaysUseBid && bidClone.adserverTargeting) {
                pb_targetingMap[bidClone.adUnitCode] = utils.extend(pb_targetingMap[bidClone.adUnitCode], bidClone.adserverTargeting);

and we also do:

// push the winning bid into targeting map
    if (adUnitCode && bidArrayTargeting.length !== 0) {
        var winningBid = getWinningBid(bidArrayTargeting);
        var keyValues = winningBid.adserverTargeting;
        pb_targetingMap[adUnitCode] = utils.extend(pb_targetingMap[adUnitCode], keyValues);
    }

The utils.extend function is applying in both of those cases. As we loop through the bidders, if one of them wins we would utils.extend the hb_pb for that pb_targetingMap. But then the next bidder would also utils.extend hb_pb property which would overwrite the winner's bid.

It seems like we need to either 1) exclude hb_pb (and possibly the other "standard" KVP) from this utils.extend logic or 2) change how getKeyValueTargetingPairs works inside bidmanager.js so that those standard KVP are/aren't included

There probably are a few folks out there who are overwriting all the KVP for each partner (ex: to target different line items), but I think in most cases they use separate KVP and these standard KVP can be kept. Sorry if my analysis doesn't help 😵 !

@mkendall07
Copy link
Member

@CarsonBanov
Spot on. I think what we need to do is prevent using alwaysUseBid with the default KVPs (or ignore them if they are used). Of course if the bid truly wins will include them. @jdelhommeau can you weigh in here and see if that is a good approach?

mkendall07 added a commit that referenced this issue Apr 1, 2016
mkendall07 added a commit that referenced this issue Apr 5, 2016
mkendall07 added a commit that referenced this issue Apr 5, 2016
Studnicky pushed a commit to sonobi/Prebid.js that referenced this issue Apr 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants