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

Wap 4485 adaptor #2

Open
wants to merge 13 commits into
base: spotx_bid_adaptor
Choose a base branch
from
Open

Wap 4485 adaptor #2

wants to merge 13 commits into from

Conversation

mgloystein
Copy link

@mgloystein mgloystein commented Jun 10, 2019

Adding the adaptor and tests

Copy link

@bluedreamer bluedreamer left a 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

}

timeDuration := string(dur)
timeCodeComponents := strings.Split(timeDuration, ":")

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"};

Copy link
Author

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)

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"
},

Copy link
Author

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")

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"

Copy link
Author

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?

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

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?)

@strider820
Copy link

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

Copy link

@thomasrmielke thomasrmielke left a 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 {

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?

Copy link
Author

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")

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]

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?

Copy link
Author

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.

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

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?

Copy link
Author

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.

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 {

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?

Copy link
Author

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.

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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not supported.

Copy link
Author

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?

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).

}

if len(param.KVP) > 0 {
ortbReq.Imp[i].Ext = kvpToExt(param.KVP)

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are they supported?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

ortbReq.BAdv = param.BlackList.Advertiser
ortbReq.BCat = param.BlackList.Category

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 {

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",

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.

@thomasrmielke
Copy link

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.

}

if len(param.KVP) > 0 {
ortbReq.Imp[i].Ext = kvpToExt(param.KVP)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

@thomasrmielke thomasrmielke left a 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.

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

Successfully merging this pull request may close these issues.

4 participants