prebid / Prebid.js

Setup and manage header bidding advertising partners without writing code or confusing line items. Prebid.js is open source and free.
https://docs.prebid.org
Apache License 2.0
1.28k stars 2.05k forks source link

s2sConfig adapterOptions are not being added to request JSON #4158

Closed npeceniak closed 4 years ago

npeceniak commented 5 years ago

Type of issue

Question

Description

I am trying to test out a new prebid server adapter that requires a few bidder specific parameters in the JSON request.ext.{BIDDER} object and based on the documentation it looks like I should be able to use the adapterOptions object in s2sConfig to add the parameters I need however the adapterOptions object I set seems to be ignored.

Steps to reproduce

  1. Download the latest prebid.js with "prebidServer" selected as an adapter.
  2. Configure adUnits and s2sConfig as listed below.

    const videoAdUnit = {
      code: 'video1',
      mediaTypes: {
          video: {
              playerSize: [400, 300],
              context: 'instream',
              mimes: ['video/mp4']
          }
      },
      bids: [{
          bidder: 'spotx',
          params: {
              placementId: 1234567, // Add your own placement id here.
              channel_id: 85394,
              ortb_version: '2.5',
              ad_unit: 'instream'
          }
      }]
    };
    
    pbjs.que.push(function(): void {
      pbjs.setConfig({
          debug: true,
          s2sConfig: {
              endpoint: 'https://eighties-prebid-prebid-server.lod.spotx.tv/openrtb2/auction',
              enabled: true,
              accountId: '101', // replace this with your account id
              bidders: ['spotx'],
              timeout: 1000,
              adapter: 'prebidServer',
              adapterOptions: {
                spotx: {
                  ortb_version: '2.5',
                  channel_id: 85394
                }
              }
          }
      });
    
      pbjs.addAdUnits(videoAdUnit);

Test page

The need for that request.ext.spotx object in the request body can be seen with the cURL requests below.

Request missing required spotx object returns error code 999 "Unexpected end of JSON input:

curl 'https://eighties-prebid-prebid-server.lod.spotx.tv/openrtb2/auction' -H 'Sec-Fetch-Mode: cors' -H 'Referer: http://localhost:4200/header-bidding?player_layout=prebid_server_header_bidding&environment=stage3&release_track=prod&debug_version=false&channel_id=1295&content_video_url=assets%2Fvideo%2Fshort_content.mp4&content_height=262&content_width=350&mvt=https:%2F%2Fpubads.g.doubleclick.net%2Fgampad%2Fads%3Fsz%3D640x480%26iu%3D%2F137679306%2F80s_regression%26impl%3Ds%26gdfp_req%3D1%26env%3Dvp%26output%3Dvast%26unviewed_position_start%3D1&dfpAdUnit=regression_1_x_1&consentMethod=0&never_load_cmp=false&delay_cmp_load=0&fail_consent_data=false&cmp=none&ados.cmp.timeout=500' -H 'Origin: http://localhost:4200' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36' -H 'Content-Type: text/plain' --data-binary '{"id":"d48b2285-e9a1-449c-b600-e3cd931ebbf1","source":{"tid":"d48b2285-e9a1-449c-b600-e3cd931ebbf1"},"tmax":1000,"imp":[{"id":"video1","ext":{"spotx":{"placementId":1234567,"channel_id":85394,"ortb_version":"2.5","ad_unit":"instream"}},"video":{"playerSize":[[400,300]],"context":"instream","mimes":["video/mp4"]}}],"test":1,"ext":{"prebid":{"targeting":{"includewinners":true,"includebidderkeys":false}}},"site":{"publisher":{"id":"101"},"page":"http://localhost:4200/header-bidding?player_layout=prebid_server_header_bidding&environment=stage3&release_track=prod&debug_version=false&channel_id=1295&content_video_url=assets%2Fvideo%2Fshort_content.mp4&content_height=262&content_width=350&mvt=https:%2F%2Fpubads.g.doubleclick.net%2Fgampad%2Fads%3Fsz%3D640x480%26iu%3D%2F137679306%2F80s_regression%26impl%3Ds%26gdfp_req%3D1%26env%3Dvp%26output%3Dvast%26unviewed_position_start%3D1&dfpAdUnit=regression_1_x_1&consentMethod=0&never_load_cmp=false&delay_cmp_load=0&fail_consent_data=false&cmp=none&ados.cmp.timeout=500"},"device":{"w":756,"h":1368}}' --compressed

cURL request including required spotx object returns a valid response:

curl 'https://eighties-prebid-prebid-server.lod.spotx.tv/openrtb2/auction' -H 'Sec-Fetch-Mode: cors' -H 'Referer: http://localhost:4200/header-bidding?player_layout=prebid_server_header_bidding&environment=stage3&release_track=prod&debug_version=false&channel_id=1295&content_video_url=assets%2Fvideo%2Fshort_content.mp4&content_height=262&content_width=350&mvt=https:%2F%2Fpubads.g.doubleclick.net%2Fgampad%2Fads%3Fsz%3D640x480%26iu%3D%2F137679306%2F80s_regression%26impl%3Ds%26gdfp_req%3D1%26env%3Dvp%26output%3Dvast%26unviewed_position_start%3D1&dfpAdUnit=regression_1_x_1&consentMethod=0&never_load_cmp=false&delay_cmp_load=0&fail_consent_data=false&cmp=none&ados.cmp.timeout=500' -H 'Origin: http://localhost:4200' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36' -H 'Content-Type: text/plain' --data-binary '{"id":"d48b2285-e9a1-449c-b600-e3cd931ebbf1","source":{"tid":"d48b2285-e9a1-449c-b600-e3cd931ebbf1"},"tmax":1000,"imp":[{"id":"video1","ext":{"spotx":{"placementId":1234567,"channel_id":85394,"ortb_version":"2.5","ad_unit":"instream"}},"video":{"playerSize":[[400,300]],"context":"instream","mimes":["video/mp4"]}}],"test":1,"ext":{"prebid":{"targeting":{"includewinners":true,"includebidderkeys":false}},"spotx":{"channel_id":85394,"ortb_version":"2.5"}},"site":{"publisher":{"id":"101"},"page":"http://localhost:4200/header-bidding?player_layout=prebid_server_header_bidding&environment=stage3&release_track=prod&debug_version=false&channel_id=1295&content_video_url=assets%2Fvideo%2Fshort_content.mp4&content_height=262&content_width=350&mvt=https:%2F%2Fpubads.g.doubleclick.net%2Fgampad%2Fads%3Fsz%3D640x480%26iu%3D%2F137679306%2F80s_regression%26impl%3Ds%26gdfp_req%3D1%26env%3Dvp%26output%3Dvast%26unviewed_position_start%3D1&dfpAdUnit=regression_1_x_1&consentMethod=0&never_load_cmp=false&delay_cmp_load=0&fail_consent_data=false&cmp=none&ados.cmp.timeout=500"},"device":{"w":756,"h":1368}}' --compressed

Expected results

When hitting the openrtb2/auction endpoint on the prebid server I expect the request JSON to look like the following:

{
    "id": "d48b2285-e9a1-449c-b600-e3cd931ebbf1",
    "source": {
        "tid": "d48b2285-e9a1-449c-b600-e3cd931ebbf1"
    },
    "tmax": 1000,
    "imp": [
        {
            "id": "video1",
            "ext": {
                "spotx": {
                    "placementId": 1234567,
                    "channel_id": 85394,
                    "ortb_version": "2.5",
                    "ad_unit": "instream"
                }
            },
            "video": {
                "playerSize": [
                    [
                        400,
                        300
                    ]
                ],
                "context": "instream",
                "mimes": [
                    "video/mp4"
                ]
            }
        }
    ],
    "test": 1,
    "ext": {
        "prebid": {
            "targeting": {
                "includewinners": true,
                "includebidderkeys": false
            }
        },
        // The spotx object below is missing from the actual request generated by prebid.js
        "spotx": {
            "channel_id": 85394,
            "ortb_version": "2.5"
        }
    },
    "site": {
        "publisher": {
            "id": "101"
        },
        "page": "http://localhost:4200/header-bidding?player_layout=prebid_server_header_bidding&environment=stage3&release_track=prod&debug_version=false&channel_id=1295&content_video_url=assets%2Fvideo%2Fshort_content.mp4&content_height=262&content_width=350&mvt=https:%2F%2Fpubads.g.doubleclick.net%2Fgampad%2Fads%3Fsz%3D640x480%26iu%3D%2F137679306%2F80s_regression%26impl%3Ds%26gdfp_req%3D1%26env%3Dvp%26output%3Dvast%26unviewed_position_start%3D1&dfpAdUnit=regression_1_x_1&consentMethod=0&never_load_cmp=false&delay_cmp_load=0&fail_consent_data=false&cmp=none&ados.cmp.timeout=500"
    },
    "device": {
        "w": 756,
        "h": 1368
    }
}

Actual results

The request JSON is generated as the following, missing the request.ext.spotx object.

{
    "id": "d48b2285-e9a1-449c-b600-e3cd931ebbf1",
    "source": {
        "tid": "d48b2285-e9a1-449c-b600-e3cd931ebbf1"
    },
    "tmax": 1000,
    "imp": [
        {
            "id": "video1",
            "ext": {
                "spotx": {
                    "placementId": 1234567,
                    "channel_id": 85394,
                    "ortb_version": "2.5",
                    "ad_unit": "instream"
                }
            },
            "video": {
                "playerSize": [
                    [
                        400,
                        300
                    ]
                ],
                "context": "instream",
                "mimes": [
                    "video/mp4"
                ]
            }
        }
    ],
    "test": 1,
    "ext": {
        "prebid": {
            "targeting": {
                "includewinners": true,
                "includebidderkeys": false
            }
        }
    },
    "site": {
        "publisher": {
            "id": "101"
        },
        "page": "http://localhost:4200/header-bidding?player_layout=prebid_server_header_bidding&environment=stage3&release_track=prod&debug_version=false&channel_id=1295&content_video_url=assets%2Fvideo%2Fshort_content.mp4&content_height=262&content_width=350&mvt=https:%2F%2Fpubads.g.doubleclick.net%2Fgampad%2Fads%3Fsz%3D640x480%26iu%3D%2F137679306%2F80s_regression%26impl%3Ds%26gdfp_req%3D1%26env%3Dvp%26output%3Dvast%26unviewed_position_start%3D1&dfpAdUnit=regression_1_x_1&consentMethod=0&never_load_cmp=false&delay_cmp_load=0&fail_consent_data=false&cmp=none&ados.cmp.timeout=500"
    },
    "device": {
        "w": 756,
        "h": 1368
    }
}

Platform details

Prebid Version. 2.30.0

Other information

jaiminpanchal27 commented 5 years ago

@npeceniak 1) You need to also include spotxBidAdapter while downloading prebid. As of now there is a dependency on client side adapter even we you are doing just server side header bidding.

2) Prebid server adapter does not ignore adapter options. It copies the value in setConfig to imp[0].ext.spotx. In above shared sample snippets, if you update the value in setConfig you will see the results.

3) I think what you are looking for is extPrebid.

pbjs.setConfig({
    s2sConfig: {
      extPrebid: {
        spotx: {
          ortb_version: '2.5',
          channel_id: 85394
        }
      }
  }
});
npeceniak commented 5 years ago

@jaiminpanchal27 Thank you for such a quick reply. I did download a the latest prebid.js and included both the spotdBidAdapter and the prebidServer so this latest test was done on version 2.31.0. I also tried using the extPrebid object as you suggested but that results in my spotx object being a child of the request.ext.prebid object and the server adapter expects the spotx object to be a sibling to the prebid one. Do you have any suggestions on how to add a object as a sibling to the prebid object instead of a child?

jaiminpanchal27 commented 5 years ago

@npeceniak I looked at prebidServerAdapter again and conclude that we cannot add object as sibling as of today. Can you create a feature request explaining your use case ? Prebid core team will take a look and get back to you.

bretg commented 5 years ago

You're right @npeceniak that the prebid.org documentation was wrong on this. The adapterOptions setting affects request.imp[].ext.BIDDER. Doc has been fixed.

So we currently support defining

Sounds like you're asking for adding ext.BIDDER as an option. I suppose that could be a new s2sConfig.ext option. We discussed that when designing s2sConfig.extPrebid and thought it best for us to limit Prebid stuff to ext.prebid.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.