google/openrtb

Suppot of adm_native field in Bid Response

m1ck43l opened this issue · 2 comments

Hi,

It seems the library can't interpret properly some BidSwitch native bid responses.
BidSwitch is using the Native Object in their bid response however instead of putting it in the Bid.adm field they put it in the Bid.adm_native field.

{
  "id":"1234567890",
  "seatbid":[
    {
      "bid":[
        {
          "id":"1",
          "impid":"102",
          "price":9.43,
          "crid":"314",
          "cid":"42",
          "language":"en",
          "burl":"https://adserver.com/imp?impid=102&winprice=${AUCTION_PRICE}",
          "adomain":[
            "advertiserdomain.com"
          ],
          "ext":{
            "advertiser_name":"Coca-Cola",
            "agency_name":"CC-advertising",
            "agency_id":"abcd1234"
          },
          "adm_native":{
            "ver":"1.2",
            "jstracker":"<html></head><body></body><script src='./jquery.js'></script></html>",
            "privacy":"https://www.example.com/privacy-notice",
            "link":{
              "url":"http://adserver.com/click?impid=102"
            },
            "imptrackers":[
              "http://adserver.com/native?impid=102"
            ],
            "assets":[
              {
                "id":1,
                "required":1,
                "title":{
                  "text":"A test Native Ad"
                }
              }
            ]
          }
        }
      ],
      "seat":"58"
    }
  ]
}

Source: https://protocol.bidswitch.com/ssp-protocol/ssp-bid-response-examples.html#native-bid-response

I saw an issue fixed in the past dealing with this issue:
#85

However the Bid.adm_native does not seem to be properly interpreted when using JSON.

I had it working by adding the following code to
https://github.com/google/openrtb/blob/master/openrtb-core/src/main/java/com/google/openrtb/json/OpenRtbJsonReader.java#L1705 :

line 1717
case "adm_native":                                                                                                                                                                                                                                                  
         bid.setAdmNative(factory().newNativeReader().readNativeResponse(par));                                                                                                                                                                                            
         break; 

So I am wondering is this a bug or something intentional to avoid the usage of the adm_native field?
If this is a bug I can open a pull request with the changes and the testing.

Thanks!

Hi Michael -- Thanks for the report and the proposed fix, but we can't have this change in the library. The field adm_native is not part of the JSON specification, and this library tries to be strict with that, the goal is supporting extensions only via the specified mechanism of ext.* nodes. The support for embedded native object inside adm is a big exception, and we only do that because it's really critical, since the doubly-encoded JSON is both very inefficient and very unreadable. In the Protobuf wire format (itself a big extension) we use an alternate name adm_native because Protobuf is statically typed so it's not possible to put either a string or a child object in the same field.

However, the library doesn't support non-standard extensions just because some platform needs it (not even AdX; our own many, many custom fields are all mapped to ext.* fields). So if BidSwitch is doing this... ideally they should fix it, they could just use the regular field name adm with the nested native object inside. Or you can fork the library to support this BidSwitch-specific field.

Hi Osvaldo
Thanks for your answer, I wasn't sure either if this was intended or not, so thanks for confirming!