Why does bidCpmAdjustment not work when aliased publisher name starts with a number?
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
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
I'm not sure if bid adjustment works with aliased bidders. I'll have to look at the code
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.
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
Your pbjs.bidderSettings is being rewritten when you're setting the brealtime bidCpmAdjustment function. You have 2 options:
- 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;}
};`
- 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, 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 ???
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 I checked your code, it looks good to me. Good catch @yairraz
I just checked the reports and the cpm adjustment is still not working for the alias bidder.
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)
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 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):

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!