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

[Question] Bid adapter get no response from DFP #6010

Closed
fasenderos opened this issue Nov 20, 2020 · 7 comments
Closed

[Question] Bid adapter get no response from DFP #6010

fasenderos opened this issue Nov 20, 2020 · 7 comments

Comments

@fasenderos
Copy link
Contributor

Type of issue

Question

Description

I'm pretty new to the world of Header Bidding and some mechanics are not very clear to me, anyway I have to write my own bid adapter (only native).

I have defined the functions isBidRequestValid() buildRequests() interpretResponse() onBidWon(). For testing purpouse I'm using integrationExamples/gpt/native_example.html with appnexusAdapter and mycustomAdapter.

I'm able to create the bid requests for my bidder’s server and parsing the bid responses. But I'm stuck on this, when my bids are higher than appnexus bids, I get no response from DFP and the onBidWon() event is not fired. While if the appenxus bids are higher than mine, I get a valid response from DFP, the appnexus onBidWon() event is fired and the adUnits are populated with the appnexus creatives.

AppNexus responds with two creatives ($0.5 cpm and $10.00 cpm), my server also responds with two creatives with random int (1-100) cpm.

That's an example of bid returned by interpretResponse:

{
   adUnitCode: "/19968336/prebid_native_example_1",
   cpm: 15,
   creativeId: "5ce6aa65bdf6bf2d36654a2d",
   currency: "EUR",
   height: 1,
   mediaType: "native",
   native: {
      title: "Other great advices to try",
      sponsoredBy: "Other Great Company",
      clickUrl: "https://affiliate.company.com/click/cn9s9c627i",
      image: {
         height: 1,
         url: "https://cdn.mysite.com/5f9aaf8b0afcd63d2c35d180.jpg",
         width: 1,
      }
   },
   netRevenue: true
   requestId: "2f30d517a4c847"
   ttl: 300,
   width: 1,
}

From the console log I can see the following info:

INFO: Invoking pbjs.onEvent Arguments
INFO: Invoking pbjs.addAdUnits 
MESSAGE: Emitting event for: addAdUnits
MESSAGE: Emitting event for: requestBids
INFO: Invoking pbjs.requestBids
MESSAGE: Emitting event for: beforeRequestBids
INFO: Bids Requested for Auction with id: f90900e7-b0da-41a1-a834-e5ca4f234891
MESSAGE: Emitting event for: auctionInit
MESSAGE: CALLING BIDDER ======= appnexus
MESSAGE: Emitting event for: bidRequested
MESSAGE: CALLING BIDDER ======= custom
MESSAGE: Emitting event for: bidRequested
MESSAGE: Emitting event for: bidAdjustment
INFO: suppressing empty key 'hb_deal' from adserver targeting
MESSAGE: Emitting event for: bidResponse
MESSAGE: Emitting event for: bidAdjustment
INFO: suppressing empty key 'hb_deal' from adserver targeting
MESSAGE: Emitting event for: bidResponse
MESSAGE: Emitting event for: bidderDone
MESSAGE: Emitting event for: bidAdjustment
INFO: suppressing empty key 'hb_deal' from adserver targeting
MESSAGE: Emitting event for: bidResponse
INFO: Bids Received for Auction with id: f90900e7-b0da-41a1-a834-e5ca4f234891
MESSAGE: Emitting event for: auctionEnd
INFO: Invoking pbjs.setTargetingForGPTAsync
MESSAGE: Attempting to set key value for slot: div-1 key: hb_native_image value: https://cdn.mysite.com/5f9aaf8b0afcd63d2c35d180.jpg
MESSAGE: Attempting to set key value for slot: div-1 key: hb_native_linkurl value: https://affiliate.company.com/click/39e6e1dwog
MESSAGE: Attempting to set key value for slot: div-1 key: hb_native_brand value: Great Company
MESSAGE: Attempting to set key value for slot: div-1 key: hb_native_title value: Try our best advises
MESSAGE: Attempting to set key value for slot: div-1 key: hb_format value: native
MESSAGE: Attempting to set key value for slot: div-1 key: hb_source value: client
MESSAGE: Attempting to set key value for slot: div-1 key: hb_size value: 1x1
MESSAGE: Attempting to set key value for slot: div-1 key: hb_pb value: 32.00
MESSAGE: Attempting to set key value for slot: div-1 key: hb_adid value: 608908d3f29299
MESSAGE: Attempting to set key value for slot: div-1 key: hb_bidder value: custom
MESSAGE: Attempting to set key value for slot: div-1 key: hb_native_linkurl_cu value: https://affiliate.company.com/click/39e6e1dwog
MESSAGE: Attempting to set key value for slot: div-1 key: hb_native_image_cust value: https://cdn.mysite.com/5f9aaf8b0afcd63d2c35d180.jpg
MESSAGE: Attempting to set key value for slot: div-1 key: hb_native_brand_cust value: Great Company
MESSAGE: Attempting to set key value for slot: div-1 key: hb_native_title_cust value: Try our best advices
MESSAGE: Attempting to set key value for slot: div-1 key: hb_format_custom value: native
MESSAGE: Attempting to set key value for slot: div-1 key: hb_source_custom value: client
MESSAGE: Attempting to set key value for slot: div-1 key: hb_size_custom value: 1x1
MESSAGE: Attempting to set key value for slot: div-1 key: hb_pb_custom value: 32.00
MESSAGE: Attempting to set key value for slot: div-1 key: hb_adid_custom value: 608908d3f29299
MESSAGE: Attempting to set key value for slot: div-1 key: hb_bidder_custom value: custom
MESSAGE: Attempting to set key value for slot: div-1 key: hb_native_linkurl_ap value: http://prebid.org/dev-docs/show-native-ads.html
MESSAGE: Attempting to set key value for slot: div-1 key: hb_native_image_appn value: https://vcdn.adnxs.com/p/creative-image/94/22/cd/0f/9422cd0f-f400-45d3-80f5-2b92629d9257.jpg
MESSAGE: Attempting to set key value for slot: div-1 key: hb_native_brand_appn value: Prebid.org
MESSAGE: Attempting to set key value for slot: div-1 key: hb_native_title_appn value: This is a Prebid Native Creative
MESSAGE: Attempting to set key value for slot: div-1 key: hb_format_appnexus value: native
MESSAGE: Attempting to set key value for slot: div-1 key: hb_source_appnexus value: client
MESSAGE: Attempting to set key value for slot: div-1 key: hb_size_appnexus value: 0x0
MESSAGE: Attempting to set key value for slot: div-1 key: hb_pb_appnexus value: 10.00
MESSAGE: Attempting to set key value for slot: div-1 key: hb_adid_appnexus value: 8fedccc6ce9763
MESSAGE: Attempting to set key value for slot: div-1 key: hb_bidder_appnexus value: appnexus
MESSAGE: Attempting to set key value for slot: div-2 key: hb_native_image value: https://cdn.mysite.com/5f9aaf8b0afcd63d2c35d180.jpg
MESSAGE: Attempting to set key value for slot: div-2 key: hb_native_linkurl value: https://affiliate.company.com/click/cn9s9c627i
MESSAGE: Attempting to set key value for slot: div-2 key: hb_native_brand value: Other Great Company
MESSAGE: Attempting to set key value for slot: div-2 key: hb_native_title value: Other great advices to try
MESSAGE: Attempting to set key value for slot: div-2 key: hb_format value: native
MESSAGE: Attempting to set key value for slot: div-2 key: hb_source value: client
MESSAGE: Attempting to set key value for slot: div-2 key: hb_size value: 1x1
MESSAGE: Attempting to set key value for slot: div-2 key: hb_pb value: 15.00
MESSAGE: Attempting to set key value for slot: div-2 key: hb_adid value: 7c0389e2b81406
MESSAGE: Attempting to set key value for slot: div-2 key: hb_bidder value: custom
MESSAGE: Attempting to set key value for slot: div-2 key: hb_native_linkurl_cu value: https://affiliate.company.com/click/cn9s9c627i
MESSAGE: Attempting to set key value for slot: div-2 key: hb_native_image_cust value: https://cdn.mysite.com/5f9aaf8b0afcd63d2c35d180.jpg
MESSAGE: Attempting to set key value for slot: div-2 key: hb_native_brand_cust value: Other Great Company
MESSAGE: Attempting to set key value for slot: div-2 key: hb_native_title_cust value: Other great advices to try
MESSAGE: Attempting to set key value for slot: div-2 key: hb_format_custom value: native
MESSAGE: Attempting to set key value for slot: div-2 key: hb_source_custom value: client
MESSAGE: Attempting to set key value for slot: div-2 key: hb_size_custom value: 1x1
MESSAGE: Attempting to set key value for slot: div-2 key: hb_pb_custom value: 15.00
MESSAGE: Attempting to set key value for slot: div-2 key: hb_adid_custom value: 7c0389e2b81406
MESSAGE: Attempting to set key value for slot: div-2 key: hb_bidder_custom value: custom
MESSAGE: Emitting event for: setTargeting
MESSAGE: Emitting event for: bidderDone

I suppose that I'm missing some configuration, because I get no error at all.
Thanks in advance

@bretg
Copy link
Collaborator

bretg commented Nov 24, 2020

The issue seems likely to be in your line item setup.

Do you have separate line items for appnexus (e.g. targeting hb_pb_appnexus) and your own (targeting hb_pb_custom)? Or do you have one line item targeting the hb_pb key-value-pair?

@fasenderos
Copy link
Contributor Author

Hi @bretg thanks for reply.
That's really strange, I'm working locally on a fake domain app.localdomanin:9999 and I have not set any line-items for either appnexus or mycustom. I don't have a GAM account at all.

But if it's mandatory to set line items, why appnexus work even if I did not set line items for appnexus?

I assumed that the problem was on GAM side, so I tried the Post-bid example. In that case it seems that the native format is not supported, because renderAd() is fired but no creative appear in the page (not even the appnexus ads).
Ads appear only if mediaType is the type of banner, but my adapter work only for native, which is the only format supported by our SSP.

@fasenderos
Copy link
Contributor Author

I assumed that the problem was on GAM side, so I tried the Post-bid example. In that case it seems that the native format is not supported, because renderAd() is fired but no creative appear in the page (not even the appnexus ads).
Ads appear only if mediaType is the type of banner, but my adapter work only for native, which is the only format supported by our SSP.

More info on postbid tested only with appnexus.

When mediaType is native, the two properties bid.ad and bid.adUrl are undefined (prebid.js line 374) and go to line 427

While if mediaType is banner the property bid.ad is set and fall into the else on line 400 that print the ad on the view.

That's the HTML:

<html>
  <head>
    <script async src="../../build/dev/prebid.js"></script>
  </head>

  <body style="margin: 0; padding: 0">
    <script>
      var sizes = [[300, 250]];
      var PREBID_TIMEOUT = 1000;
      var adUnits = [
        {
          code: "postbid_iframe",
          sizes: [[1, 1]],

          /***  START BANNER
          mediaTypes: {
            banner: {
              sizes: sizes,
            },
          },
          bids: [
            {
              bidder: "appnexus",
              params: {
                placementId: 13144370,
              },
            },
          ],
          END BANNER *** /

          /***  START NATIVE ***/
          mediaTypes: {
            native: {
              title: {
                required: true,
              },
              body: {
                required: true,
              },
              image: {
                required: true,
              },
              sponsoredBy: {
                required: true,
              },
              icon: {
                required: false,
              },
            },
          },
          bids: [
            {
              bidder: "appnexus",
              params: {
                placementId: 13232354,
                allowSmallerSizes: true,
              },
            },
          ],
          /***  END NATIVE ***/
        },
      ];

      var pbjs = pbjs || {};
      pbjs.que = pbjs.que || [];

      pbjs.que.push(function () {
        pbjs.addAdUnits(adUnits);
        pbjs.requestBids({
          timeout: PREBID_TIMEOUT,
          bidsBackHandler: function () {
            var iframe = document.getElementById("postbid_iframe");
            var iframeDoc = iframe.contentWindow.document;
            var adServerTargeting = pbjs.getAdserverTargetingForAdUnitCode(
              "postbid_iframe"
            );

            // If any bidders return any creatives
            if (adServerTargeting && adServerTargeting["hb_adid"]) {
              pbjs.renderAd(iframeDoc, adServerTargeting["hb_adid"]);
            } else {
              iframe.width = sizes[0][0];
              iframe.height = sizes[0][1];
              iframeDoc.write(
                "<head></head><body>" + passbackTagHtml + "</body>"
              );
              iframeDoc.close();
            }
          },
        });
      });

      // Define the passback HTML tag here.
      // Note that this tag is usually in either Script tag form or iFrame form.
      var passbackTagHtml = "TO ADD";
    </script>

    <iframe
      id="postbid_iframe"
      frameborder="0"
      scrolling="no"
      marginheight="0"
      marginwidth="0"
      TOPMARGIN="0"
      LEFTMARGIN="0"
      ALLOWTRANSPARENCY="true"
      width="0"
      height="0"
    >
    </iframe>
  </body>
</html>

@bretg
Copy link
Collaborator

bretg commented Nov 24, 2020

You're right, can't do PBJS native "alpha" without an ad server. We're soon going to release "native 2.0" which could theoretically do this, but it's a use case we haven't documented. Is it a real scenario or just for your testing?

@fasenderos
Copy link
Contributor Author

fasenderos commented Nov 25, 2020

Hi @bretg, that's my scenario. I'm a developer at Nativery, a native advertising platform (to be clear a sort of little Taboola), where Advertisers can create campaigns and ads, and Publishers can create widgets (In-feed, In-ad, Recommendation etc..) to display native advertising by adding a javascript snippet code in their website.
Since we want to introduce Programmatic Advertising in our platform (we would like to start with Xandr), I thought that a possible solution was to create a prebid adapter for our server and inject prebid.js in the snippet with appnexus and our adapter.

I have finished the adapter, but here comes the problem. If I have understood correctly I have to set key-values based on the inventory sizes that a website has. Since we are a platform with hundreds of publishers (each with one or more website), does this means that I have to repeat these steps for every domain we manage? Not really a viable option.

Besides, there's one thing still bothers me. If it's mandatory to set line items, why appnexus work even if I haven't set any, while my adapter don't?

Another solution is to go without an ad server, but at the moment the renderAd() function not support native format.

Am I right or are there other better solutions to implement Native Programmatic Advertising?

@bretg
Copy link
Collaborator

bretg commented Nov 25, 2020

If it's mandatory to set line items

This is the way header bidding has always worked -- it was designed to get some optional open market bids that can compete in the ad server with a publisher's direct-sold ads.

You could come up with a hack to skip the ad server even with native:

  • in the bidsBack handler, create the HTML body similar to what's described at https://docs.prebid.org/adops/setting-up-prebid-native-in-dfp.html for the creative body that goes into the ad server. No macros of course - fully resolved HTML.
  • call renderAd() on that creative body
  • this will load native-trk.js and then call window.pbNativeTag.startTrackers()

One issue here is that Native was originally envisioned to let Publishers control the templates. I think in your case though, you want to control the template.

are there other better solutions to implement Native Programmatic Advertising

You're welcome to check out the draft PBJS Native 2.0 documentation to see what's coming soon. When released, this will give you the option of defining the creative template in the AdUnit rather than the ad server. It would improve the approach noted above, which is something we could document if it works out for you.

@fasenderos
Copy link
Contributor Author

You could come up with a hack to skip the ad server even with native:

  • in the bidsBack handler, create the HTML body similar to what's described at https://docs.prebid.org/adops/setting-up-prebid-native-in-dfp.html for the creative body that goes into the ad server. No macros of course - fully resolved HTML.
  • call renderAd() on that creative body
  • this will load native-trk.js and then call window.pbNativeTag.startTrackers()

@bretg thank you so much, thats was really helpful.

You're welcome to check out the draft PBJS Native 2.0 documentation to see what's coming soon. When released, this will give you the option of defining the creative template in the AdUnit rather than the ad server. It would improve the approach noted above, which is something we could document if it works out for you.

It will be definitely an improvement. Thanks for your great work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants