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

How to do configure a bidder alias?

Open joyofdata opened this issue 10 years ago • 15 comments

Sekindo contacted us with the information that their adapter won't work for a while (in conjunction with some fundamental changes in prebid.js introduced in the most recent version 0.14.0) and we should switch to AppNexus. But especially because we use the bidder names to distinguish the networks for our reporting I need to keep using the name "sekindo". If I am not mistaken pbjs.aliasBidder("appnexus","sekindo"); should accomplish exactly that - but it didn't.

So here's what I did - using the Postbid example code to illustrate - two changes at (A) and (B):

<html>
<head>
<script>
  var tagWidth = 300;
  var tagHeight = 250;

  var bids = [{
      bidder: 'appnexus',
      params: {
         placementId: '4799418'
      }
    }, 
    {
      bidder: 'sekindo',
      params: {
          // (A) now placementId with new value provided by Sekindo for a given placement
          // spaceId: '12345'
          placementId: '54321'
      }
    }
  ];
    
  var bidTimeOut = 1000;

  var passbackTagHtml = '<scr' + 'ipt type='text/javascript' src='https://www.googletagservices.com/tag/js/gpt.js'>googletag.pubads().definePassback('/19968/header-bid-passback-tag', [300, 250]).display();</scr' + 'ipt>'
</script>

<script type="text/javascript" src="//acdn.adnxs.com/prebid/not-for-prod/prebid.js" async></script>

<script>
  var pbjs = pbjs || {};
  pbjs.que = pbjs.que || [];

  var doNotChange = 'doNotChange';

  pbjs.que.push(function() {

    // (B) Here I specify that "sekindo" is supposed to use the "appnexus" adapter
    pbjs.aliasBidder("appnexus","sekindo");

    var adUnits = [{
      code: doNotChange,
      sizes: [[tagWidth, tagHeight]],
      bids: bids
    }];

    pbjs.addAdUnits(adUnits);

    pbjs.requestBids({
      timeout: bidTimeOut,
      bidsBackHandler: function() {
        var iframe = document.getElementById('postbid_if');
        var iframeDoc = iframe.contentWindow.document;
        var params = pbjs.getAdserverTargetingForAdUnitCode(doNotChange);

        if (params && params['hb_adid']){
          pbjs.renderAd(iframeDoc, params['hb_adid']);
        } else {
          iframe.width = tagWidth;
          iframe.height = tagHeight;
          iframeDoc.write(passbackTagHtml);
        }
      }
    });
  });
</script>
</head>

<body style="margin:0;padding:0">
<iframe id='postbid_if' FRAMEBORDER="0" SCROLLING="no" MARGINHEIGHT="0" MARGINWIDTH="0" TOPMARGIN="0" LEFTMARGIN="0" ALLOWTRANSPARENCY="true" WIDTH="0" HEIGHT="0"></iframe>
</body>

</html>

For some reason though this leads to no more bids being received from Sekindo.

What am I doing wrong?

joyofdata avatar Nov 08 '16 13:11 joyofdata

It seems that it is necessary to place pbjs.aliasBidder("appnexus","sekindo"); after pbjs.addAdUnits(adUnits);.

Another possibility is to configure the alias in adapters.json before building.

{
  "appnexus": {
    "alias": "brealtime"
  }
}

joyofdata avatar Nov 10 '16 09:11 joyofdata

@joyofdata

Is building with alias in adaptors.json sufficient or we need to do pbjs.aliasBidder("appnexus","districtm"); all the time ?

stagingUser avatar Mar 06 '17 07:03 stagingUser

@joyofdata

Is building with alias in adaptors.json sufficient or we need to do pbjs.aliasBidder("appnexus","districtm"); all the time ?

sandeep-patel avatar Mar 06 '17 07:03 sandeep-patel

@Sandeep-Patel building with alias in adapter.json is sufficient

joyofdata avatar Mar 06 '17 10:03 joyofdata

Questions:

a. Do we post a Git Hub request to add "digitalthrottle" as an Alias? We've been sending our AppNexus placement ID to our publishers and it's creating confusion.

b. Can we instruct the publisher on how to directly update their own adapters.json file to add us as an alias or is this a common JSON controlled by Pre-Bid.

Thanks for the help!

digitalthrottle avatar Jun 21 '17 19:06 digitalthrottle

@digitalthrottle aliases are currently controlled via each adapter file. You should submit a PR to add an alias.

mkendall07 avatar Sep 25 '17 17:09 mkendall07

How about the bidCpmAdjustment settings for the alias? It seems that even if we use an alias for a second 'appnexus' partner, there is only one 'appnexus' bidCpmAdjustment called and not for the alias one.

pboisso avatar Nov 04 '17 14:11 pboisso

Hi,

What are the build parameters for building with alias adapters? I tried the following and it failed:

gulp build --modules=modules.json,adapters.json

mhmgdk avatar Nov 13 '17 11:11 mhmgdk

@pboisso You need to setup the bidAdjustment for the alias as well. @mhmgdk

You can see build instructions in the readme here: https://github.com/prebid/Prebid.js#Build

mkendall07 avatar Nov 14 '17 15:11 mkendall07

Thanks @mkendall07 , I finally got it to work. I've never been able to send the alias to S2S however (despite the fact that it's an AppNexus alias, thus supporting S2S).

pboisso avatar Nov 14 '17 15:11 pboisso

That makes sense... unfortunately Prebid Server doesn't support Aliases yet, so there's not much Prebid.JS can do about it.

There is/was some discussion here: https://github.com/prebid/prebid-server/issues/11

Feel free to chime in with thumbs up or any details about your needs.

dbemiller avatar Nov 14 '17 16:11 dbemiller

@mkendall07 The build instructions does mention how to build with a limited set of modules, but not how to include aliasing in the build. The modules.json file in the instructions contains a regular array and the adapters.json file contains an associative array according to comment from @joyofdata, so the format is different. Is there a command line option to gulp that includes a adapters.json file containing an associative array of adapter aliases?

mhmgdk avatar Nov 14 '17 18:11 mhmgdk

@mhmgdk No, we don't offer a build time alias function any longer.

mkendall07 avatar Nov 14 '17 19:11 mkendall07

@mkendall07 I see. I found some old documentation suggesting gulp build --adapters adapters.json But the resulting prebid.js file does not contain the aliases, so I guess that the build command at some point has been replaced with gulp build --modules=modules.json without including the support for aliasing and thereby the option to build prebid.js with aliasing support for the moment. Right? So I guess that setting pbjs.aliasBidder("bidder","alias"); is the only option for now?

mhmgdk avatar Nov 14 '17 20:11 mhmgdk

@mhmgdk correct

mkendall07 avatar Jan 08 '18 22:01 mkendall07