-
Notifications
You must be signed in to change notification settings - Fork 0
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
Wap 4485 adaptor #2
base: spotx_bid_adaptor
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have more to look at but maybe you can get started on current comments
adapters/spotx/spotx.go
Outdated
} | ||
|
||
timeDuration := string(dur) | ||
timeCodeComponents := strings.Split(timeDuration, ":") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might find these useful - these are from the C++ vast unit tests
static std::vectorstd::string invalid_time_strings = {"invalid",
"0s",
"00:00",
"00:00:0",
"00:0:00",
"00:00:000",
"00:000:00",
"00:00:00.0",
"00:00:00.00",
"00:00:00.0000",
"00:00:00PM"};
static std::vectorstd::string valid_time_strings =
{"0:00:00", "00:00:00", "00:00:00.000", "000:00:00.000", "123:45:56.789", "9999:99:99.999"};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change it to a float64 and increase my slice capacity to 16.
httpReq.Header.Add("Content-Type", "application/json;charset=utf-8") | ||
httpReq.Header.Add("Accept", "application/json") | ||
|
||
resp, err := ctxhttp.Do(ctx, a.http.Client, httpReq) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the request you are sending to spotx right? So a lot of our content is going to be refined on geo/device type - so I wonder if you need this section
"device":{
"h":736,
"w":414,
"lmt":0,
"connectionType":2,
"make":"Apple",
"model":"iPhone9,4",
"os":"iOS",
"osv":"11.2.6",
"ua":"Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_6 like Mac OS X) AppleWebKit/604.5.6 (KHTML,like Gecko) Mobile/15D100",
"ifa":"EEBBF4EE-3B08-4556-BC3E-CCD3EBB8E4B4",
"geo":{
"country":"NZ",
"city":"Auckland",
"zip":"1150"
},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully all that information will already be in the request and correctly massaged into the Open RTB request we are making to ourselves. Call
calls this method after calling adapters.MakeOpenRTBGeneric
, which is meant to transform the prebid request into an ortb request. Device is part of both specs so I assume that translation is done in that call.
|
||
httpReq, err := http.NewRequest("POST", uri, bytes.NewBuffer(reqJSON)) | ||
httpReq.Header.Add("Content-Type", "application/json;charset=utf-8") | ||
httpReq.Header.Add("Accept", "application/json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should set a user agent so we can id our own calls
"User-Agent: spotx-prebidderwidget_do_dad"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have an idea of what a legitimate value should be for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be nice to identify, so how about "spotx_prebid_server 1.0" or similar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SpotMarket needs the user agent accurately reflect the device that the ad will run on. We use it for audience identification, device targeting, etc. I would suggest another method for indicating prebid server calls (maybe supply chain?)
I'll let others leave comments for things I might have missed, but from my perspective, it seems like it'd do what I'd expect for prebid server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this adapter is sending a lot of fields that are not currently supported by SpotX. It will not cause an error in the request, but the extra fields will be ignored.
Also, it was a little difficult to trace the flow of the code. I expected to see the bids constructed hierarchically, but it didn't seem to be organized that way. That being said, I'm not familiar with a lot of the syntax in Go, so that may be contributing to it.
Have you tried connecting the requests generated here with a test SpotX server to validate the responses?
return | ||
} | ||
|
||
if config.ChannelID == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you checking for '0' here specifically because it's a default value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
|
||
httpReq, err := http.NewRequest("POST", uri, bytes.NewBuffer(reqJSON)) | ||
httpReq.Header.Add("Content-Type", "application/json;charset=utf-8") | ||
httpReq.Header.Add("Accept", "application/json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SpotMarket needs the user agent accurately reflect the device that the ad will run on. We use it for audience identification, device targeting, etc. I would suggest another method for indicating prebid server calls (maybe supply chain?)
if imp.ID == bid.ImpID { | ||
if imp.Video != nil { | ||
if len(bid.Cat) > 0 { | ||
cat = bid.Cat[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only the first element in bid.Cat?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to find a primary category in our result but the object passed to the decision point requires there be a primary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
) | ||
|
||
vastXmlSearch: | ||
for i := 0; i < len(vastResponse); i++ { // Iterate over every character |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you writing an xml parser here? Are there no available libs to parse XML?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not fully parsing the xml, I only care about a single value and this has to be fast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
|
||
func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { | ||
for _, imp := range imps { | ||
if imp.ID == impId { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if this is a realistic request, but what if there are multiple objects specified? The spec doesn't indicate that the values are mutually exclusive. This might be a question for product.
Also, there is an implicit precedence for choosing the media type. Is that intentionally? E.g., video will always be choosen over audio?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think an impression can only have one type and the requester would have to specify another impression if they wanted a bid for a different type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, any reason for the implicit precedence chosen here? Video over audio?
ortbReq.Imp[i].BidFloorCur = param.Currency | ||
|
||
if param.Boxing.Valid && param.Boxing.Bool { | ||
ortbReq.Imp[1].Video.BoxingAllowed = int8(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it break things? Might it be supported in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will not break things. Just suggesting that you could limit the scope of your work to just the supported fields (reduces our bandwidth too).
adapters/spotx/spotx.go
Outdated
} | ||
|
||
if len(param.KVP) > 0 { | ||
ortbReq.Imp[i].Ext = kvpToExt(param.KVP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the code and docs, I don't believe KVPs are supported this way either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are they supported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per our docs, in the video ext field (not the imp.ext). See https://confluence.spotxchange.com/display/byndocspotx/SpotMarket+Publisher+OpenRTB+Endpoint+Support
} | ||
|
||
ortbReq.BAdv = param.BlackList.Advertiser | ||
ortbReq.BCat = param.BlackList.Category |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not supported.
|
||
ortbReq.WLang = param.WhiteList.Language | ||
|
||
if len(param.WhiteList.Seat) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not supported.
"tmax": 9000, | ||
"ext": { | ||
"spotx":{ | ||
"ortb_version": "2.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't currently supported.
There are several internal SpotX confluence pages outlining what is supported on the pORTB endpoint and what isn't. Let me know if you'd like those pages. |
adapters/spotx/spotx.go
Outdated
} | ||
|
||
if len(param.KVP) > 0 { | ||
ortbReq.Imp[i].Ext = kvpToExt(param.KVP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per our docs, in the video ext field (not the imp.ext). See https://confluence.spotxchange.com/display/byndocspotx/SpotMarket+Publisher+OpenRTB+Endpoint+Support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor questions remain. Outstanding issues would be the custom kvps and user agent.
77a974f
to
e1ed5a6
Compare
696ea51
to
ed0b189
Compare
Adding the adaptor and tests