Prebid.js icon indicating copy to clipboard operation
Prebid.js copied to clipboard

Why does bidCpmAdjustment not work when aliased publisher name starts with a number?

Open headerbidding opened this issue 10 years ago • 13 comments

Hi Matt,

Observation: The bid ajustment for 152media is ignored. The bid ajustment for brealtime works fine.

Code:

pbjs.que.push(function() {
    pbjs.addAdUnits(adUnits);
    pbjs.aliasBidder('appnexus', '152media');

pbjs.bidderSettings = {};
pbjs.bidderSettings['152media'] = {
    bidCpmAdjustment: function(bidCpm) {
    return bidCpm * .10;}
};

pbjs.bidderSettings = {brealtime: {
    bidCpmAdjustment : function(bidCpm){
      return bidCpm * .10;}
  }
};

Test page: http://www.flixxy.com/prebid-brealtime-bidadjustment-test.htm?pbjs_debug=true

headerbidding avatar Nov 10 '16 21:11 headerbidding

The problem is with this part of the code, which you previously suggested:

pbjs.bidderSettings = {}; pbjs.bidderSettings['152media'] = { bidCpmAdjustment: function(bidCpm) { return bidCpm * .10;} };

There is no more syntax error (due to the publisher name starting with a number), but the code does not work to adjust the CPM. Any suggestions? (I am not a JavaScript Programmer)

PS: As a work-around for now, I will just rename 152media to one52media

headerbidding avatar Nov 11 '16 01:11 headerbidding

I'm not sure if bid adjustment works with aliased bidders. I'll have to look at the code

mkendall07 avatar Nov 11 '16 14:11 mkendall07

I looked at the code earlier and didn't see any reason why it should not work for an aliased bidder. I didn't have time to test it though so I'll do that next.

mkendall07 avatar Nov 12 '16 01:11 mkendall07

I did some more experimenting and It seems that the brealtime price adjustment is preventing the alias price adjustment.

PS: I am not a trained javascript programmer

headerbidding avatar Nov 12 '16 17:11 headerbidding

Your pbjs.bidderSettings is being rewritten when you're setting the brealtime bidCpmAdjustment function. You have 2 options:

  1. Use the object property setting for the second adapter (and all of the following) like this:
`pbjs.bidderSettings.brealtime= {
    bidCpmAdjustment: function(bidCpm) {
    return bidCpm * .10;}
};`
  1. set evertything up in one setting, like this:
pbjs.bidderSettings = {
  '152media': {
    bidCpmAdjustment: function( bidCpm ) {
      return bidCpm * .10;
    }
  },
  brealtime: {
    bidCpmAdjustment: function( bidCpm ) {
      return bidCpm * .10;
    }
  }
};

This has probably nothing to do with aliased adapters.

yairraz avatar Nov 12 '16 17:11 yairraz

yairraz, you are a genius! I think that is it.

I am testing it right now, by checking the appnexus report, but I have to wait a few hours to see the results. Unless there is another, easier and better way to test for cpmbidadjustment ???

headerbidding avatar Nov 12 '16 20:11 headerbidding

Also - I have the pbjs.bidderSettings code right below

googletag.pubads().disableInitialLoad(); });

Is that correct?

This is my current code: http://www.flixxy.com/prebid.htm?pbjs_debug=true

headerbidding avatar Nov 12 '16 23:11 headerbidding

@headerbidding I checked your code, it looks good to me. Good catch @yairraz

mkendall07 avatar Nov 13 '16 00:11 mkendall07

I just checked the reports and the cpm adjustment is still not working for the alias bidder.

headerbidding avatar Nov 13 '16 01:11 headerbidding

But when I remove the brealtime bid adjustment, the one52media adjustment then seems to work. (I have not fully tested it - need to wait 4 hours for the final report results)

headerbidding avatar Nov 13 '16 02:11 headerbidding

I removed the brealtime bid adjustment and the one52media adjustment now works. So there is a conflict (bug) between the appnexus adapter and the brealtime adapter.

headerbidding avatar Nov 13 '16 14:11 headerbidding

@headerbidding I tested your example and it works fine. Here is the code: https://jsfiddle.net/u975ypkj/ Note it actually doesn't run on jsfiddle because of a cross domain iframe issue, but it will work if you run it on your own server.

Here is a screen shot showing the correct adjustments being made (original bid is $1.00): image

mkendall07 avatar Nov 14 '16 15:11 mkendall07

Thank you, Matt! I checked the reports this morning, and you are correct - it is indeed working!

Thank you for sending me the jsfiddle link. I need to familiarize myself with this great tool!

headerbidding avatar Nov 14 '16 15:11 headerbidding