-
Notifications
You must be signed in to change notification settings - Fork 760
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
Adgeneration: Update request to include device and app related info in headers and query params #2109
Adgeneration: Update request to include device and app related info in headers and query params #2109
Changes from all commits
4a6ae5d
e1dc82f
1257480
c4f1358
98e1502
0c0aea7
3dd722d
0719de6
fb6f239
e0a628d
49f55bd
31b63ad
f9bb38c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,8 +55,13 @@ func (adg *AdgenerationAdapter) MakeRequests(request *openrtb2.BidRequest, reqIn | |
headers := http.Header{} | ||
headers.Add("Content-Type", "application/json;charset=utf-8") | ||
headers.Add("Accept", "application/json") | ||
if request.Device != nil && len(request.Device.UA) > 0 { | ||
headers.Add("User-Agent", request.Device.UA) | ||
if request.Device != nil { | ||
if len(request.Device.UA) > 0 { | ||
headers.Add("User-Agent", request.Device.UA) | ||
} | ||
if len(request.Device.IP) > 0 { | ||
headers.Add("X-Forwarded-For", request.Device.IP) | ||
} | ||
} | ||
|
||
bidRequestArray := make([]*adapters.RequestData, 0, numRequests) | ||
|
@@ -102,7 +107,6 @@ func (adg *AdgenerationAdapter) getRawQuery(id string, request *openrtb2.BidRequ | |
v := url.Values{} | ||
v.Set("posall", "SSPLOC") | ||
v.Set("id", id) | ||
v.Set("sdktype", "0") | ||
v.Set("hb", "true") | ||
v.Set("t", "json3") | ||
v.Set("currency", adg.getCurrency(request)) | ||
|
@@ -112,12 +116,32 @@ func (adg *AdgenerationAdapter) getRawQuery(id string, request *openrtb2.BidRequ | |
if adSize != "" { | ||
v.Set("sizes", adSize) | ||
} | ||
if request.Device != nil && request.Device.OS == "android" { | ||
v.Set("sdktype", "1") | ||
} else if request.Device != nil && request.Device.OS == "ios" { | ||
v.Set("sdktype", "2") | ||
} else { | ||
v.Set("sdktype", "0") | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just want to reiterate the need for json tests for these new conditionals! |
||
if request.Site != nil && request.Site.Page != "" { | ||
v.Set("tp", request.Site.Page) | ||
} | ||
if request.Source != nil && request.Source.TID != "" { | ||
v.Set("transactionid", request.Source.TID) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line isn't new code, but I checked the test coverage and it isn't covering this case, so we'll need a json test for this too! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AlexBVolcy |
||
} | ||
if request.App != nil && request.App.Bundle != "" { | ||
v.Set("appbundle", request.App.Bundle) | ||
} | ||
if request.App != nil && request.App.Name != "" { | ||
v.Set("appname", request.App.Name) | ||
} | ||
if request.Device != nil && request.Device.OS == "ios" && request.Device.IFA != "" { | ||
v.Set("idfa", request.Device.IFA) | ||
} | ||
if request.Device != nil && request.Device.OS == "android" && request.Device.IFA != "" { | ||
v.Set("advertising_id", request.Device.IFA) | ||
} | ||
|
||
return &v | ||
} | ||
|
||
|
@@ -263,7 +287,7 @@ func removeWrapper(ad string) string { | |
func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { | ||
bidder := &AdgenerationAdapter{ | ||
config.Endpoint, | ||
"1.0.2", | ||
"1.0.3", | ||
"JPY", | ||
} | ||
return bidder, nil | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
{ | ||
"mockBidRequest":{ | ||
"id": "some-request-id", | ||
"site": { | ||
"page": "http://example.com/test.html" | ||
}, | ||
"device": { | ||
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36", | ||
"ip": "0.0.0.0", | ||
"os": "android", | ||
"ifa": "advertising_id" | ||
}, | ||
"app": { | ||
"name": "adgneration" | ||
}, | ||
"imp": [ | ||
{ | ||
"id": "some-impression-id", | ||
"banner": { | ||
"format": [ | ||
{ | ||
"w": 300, | ||
"h": 250 | ||
} | ||
] | ||
}, | ||
"ext": { | ||
"bidder": { | ||
"id": "58278" | ||
} | ||
} | ||
} | ||
], | ||
"tmax": 500 | ||
}, | ||
"httpCalls": [ | ||
{ | ||
"internalRequest": { | ||
"id": "some-request-id", | ||
"site": { | ||
"page": "http://example.com/test.html" | ||
}, | ||
"imp": [ | ||
{ | ||
"id": "some-impression-id", | ||
"banner": { | ||
"format": [ | ||
{ | ||
"w": 300, | ||
"h": 250 | ||
} | ||
] | ||
}, | ||
"ext": { | ||
"bidder": { | ||
"id": "58278" | ||
} | ||
} | ||
} | ||
], | ||
"tmax": 500 | ||
}, | ||
"expectedRequest":{ | ||
"uri": "https://d.socdm.com/adsv/v1?adapterver=1.0.3&advertising_id=advertising_id&appname=adgneration¤cy=JPY&hb=true&id=58278&posall=SSPLOC&sdkname=prebidserver&sdktype=1&sizes=300x250&t=json3&tp=http%3A%2F%2Fexample.com%2Ftest.html", | ||
"headers": { | ||
"Accept": [ | ||
"application/json" | ||
], | ||
"Content-Type": [ | ||
"application/json;charset=utf-8" | ||
], | ||
"User-Agent": [ | ||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36" | ||
], | ||
"X-Forwarded-For": [ | ||
"0.0.0.0" | ||
] | ||
} | ||
}, | ||
"mockResponse":{ | ||
"status": 200, | ||
"body": { | ||
"ad": "<!DOCTYPE html>\n <head>\n <meta charset=\"UTF-8\">\n <script src=\"https:\/\/i.socdm.com\/sdk\/js\/adg-script-base.js\" type=\"text\/javascript\"><\/script>\n <script type=\"text\/javascript\">\n adsettings = {\n locationid : 58278,\n rotation : 0,\n displaytype : 1,\n sdktype : \"0\",\n scheduleid : 512601\n };\n <\/script>\n <style>\n body {\n margin:0;\n padding:0;\n }\n <\/style>\n <\/head>\n <body>\n <div id=\"medibasspContainer\">\n <iframe src=\"https:\/\/s3-ap-northeast-1.amazonaws.com\/sdk-temp\/adg-sample-ad\/300x250.html?prc=-Cuepak&rd=https%3A%2F%2Ftg.socdm.com%2Frd%2Fv1%2Fz%2FhKFj2gDXY2hzbT0xOTgsZmJkZGMyNWEvNTgyNzgvU1NQTE9DLzUxMjYwMS83MjExNS43Njg1NS41MTI2MDEvMTA5MzkyNi82NDkxOS81ODI3ODpTU1BMT0M6Ki9jdD0xNTg1MjEyMDg1Nzg5O3NyPWh0dHBzO2RzcGlkPTMwMTtwcj16RGFfYVY0O3ByYj15UTtwcm89eVE7cHJvYz1KUFk7Y3JkMnk9MTA5LjQzMDAwMDAwMDAwMDAxO2NyeTJkPTAuMDA5MTM4MjYxOTAyNTg2MTI3MztpZHg9MDulc2VxaWTaACQ0NzFhM2JlNS1lYTQzLWRhZjAtYjhjZi1mNjJkNTA1N2Y5ZWOnc2VxdGltZa0xNTg1MjEyMDg1Nzg5pHh1aWS4WE52SVNNQ281bUlBQU1hN2dOUUFBQUFB%2Fp%2Fctsv%3Dm-ad226%3Bseqid%3D471a3be5-ea43-daf0-b8cf-f62d5057f9ec%3B%2Fg%2FU%3A%3Furl%3D\" style=\"border: 0px;\" width=\"300\" height=\"250\" frameborder=\"0\" scrolling=\"no\"><\/iframe>\n <\/div>\n <\/body>\n", | ||
"beacon": "<img src=\"https://tg.socdm.com/bc/v3?b=beaconID&xuid=XUID&ctsv=CTSV&seqid=SeqID&seqtime=SeqTime&seqctx=SeqCtx&t=.gif\" width=\"1\" height=\"1\" style=\"display:none;border:none;padding:0;margin:0;width:1px;height:1px\"/>", | ||
"beaconurl": "https://tg.socdm.com/bc/v3?b=beaconID&t=.gif", | ||
"cpm": 46.6, | ||
"creativeid": "Dummy_supership.jp", | ||
"displaytype": "1", | ||
"h": 250, | ||
"ids": { | ||
"anid": "", | ||
"diid": "", | ||
"idfa": "", | ||
"soc": "Soc" | ||
}, | ||
"location_params": null, | ||
"locationid": "58278", | ||
"results": [ | ||
{ | ||
"ad": "<!DOCTYPE html>\n <head>\n <meta charset=\"UTF-8\">\n <script src=\"https:\/\/i.socdm.com\/sdk\/js\/adg-script-base.js\" type=\"text\/javascript\"><\/script>\n <script type=\"text\/javascript\">\n adsettings = {\n locationid : 58278,\n rotation : 0,\n displaytype : 1,\n sdktype : \"0\",\n scheduleid : 512601\n };\n <\/script>\n <style>\n body {\n margin:0;\n padding:0;\n }\n <\/style>\n <\/head>\n <body>\n <div id=\"medibasspContainer\">\n <iframe src=\"https:\/\/s3-ap-northeast-1.amazonaws.com\/sdk-temp\/adg-sample-ad\/300x250.html?prc=-Cuepak&rd=https%3A%2F%2Ftg.socdm.com%2Frd%2Fv1%2Fz%2FhKFj2gDXY2hzbT0xOTgsZmJkZGMyNWEvNTgyNzgvU1NQTE9DLzUxMjYwMS83MjExNS43Njg1NS41MTI2MDEvMTA5MzkyNi82NDkxOS81ODI3ODpTU1BMT0M6Ki9jdD0xNTg1MjEyMDg1Nzg5O3NyPWh0dHBzO2RzcGlkPTMwMTtwcj16RGFfYVY0O3ByYj15UTtwcm89eVE7cHJvYz1KUFk7Y3JkMnk9MTA5LjQzMDAwMDAwMDAwMDAxO2NyeTJkPTAuMDA5MTM4MjYxOTAyNTg2MTI3MztpZHg9MDulc2VxaWTaACQ0NzFhM2JlNS1lYTQzLWRhZjAtYjhjZi1mNjJkNTA1N2Y5ZWOnc2VxdGltZa0xNTg1MjEyMDg1Nzg5pHh1aWS4WE52SVNNQ281bUlBQU1hN2dOUUFBQUFB%2Fp%2Fctsv%3Dm-ad226%3Bseqid%3D471a3be5-ea43-daf0-b8cf-f62d5057f9ec%3B%2Fg%2FU%3A%3Furl%3D\" style=\"border: 0px;\" width=\"300\" height=\"250\" frameborder=\"0\" scrolling=\"no\"><\/iframe>\n <\/div>\n <\/body>\n", | ||
"beacon": "<img src=\"https://tg.socdm.com/bc/v3?b=beaconID&xuid=XUID&ctsv=CTSV&seqid=SeqID&seqtime=SeqTime&seqctx=SeqCtx&t=.gif\" width=\"1\" height=\"1\" style=\"display:none;border:none;padding:0;margin:0;width:1px;height:1px\"/>", | ||
"beaconurl": "https://tg.socdm.com/bc/v3?b=beaconID&t=.gif", | ||
"cpm": 46.6, | ||
"creativeid": "Dummy_supership.jp", | ||
"h": 250, | ||
"landing_url": "", | ||
"scheduleid": "512601", | ||
"trackers": { | ||
"imp": [ | ||
"https://tg.socdm.com/bc/v3?b=beaconID&t=.gif" | ||
], | ||
"viewable_imp": [ | ||
"https://tg.socdm.com/aux/inview?creative_id=1093926&ctsv=CTSC&extra_field=ExtraField&family_id=512601&id=58278&loglocation_id=64919&lookupname=58278%3ASSPLOC%3A*&pos=SSPLOC&schedule_id=72115.76855.512601&seqid=SeqID&seqtime=SeqTime&xuid=XUID" | ||
], | ||
"viewable_measured": [ | ||
"https://tg.socdm.com/aux/measured?creative_id=1093926&ctsv=CTSC&extra_field=ExtraField&family_id=512601&id=58278&loglocation_id=64919&lookupname=58278%3ASSPLOC%3A*&pos=SSPLOC&schedule_id=72115.76855.512601&seqid=SeqID&seqtime=SeqTime&xuid=XUID" | ||
] | ||
}, | ||
"ttl": 10, | ||
"w": 300, | ||
"weight": 1 | ||
} | ||
], | ||
"dealid": "test-deal-id", | ||
"rotation": "0", | ||
"scheduleid": "512601", | ||
"sdktype": "0", | ||
"trackers": { | ||
"imp": [ | ||
"https://tg.socdm.com/bc/v3?b=beaconID&t=.gif" | ||
], | ||
"viewable_imp": [ | ||
"https://tg.socdm.com/aux/inview?creative_id=1093926&ctsv=CTSC&extra_field=ExtraField&family_id=512601&id=58278&loglocation_id=64919&lookupname=58278%3ASSPLOC%3A*&pos=SSPLOC&schedule_id=72115.76855.512601&seqid=SeqID&seqtime=SeqTime&xuid=XUID" | ||
], | ||
"viewable_measured": [ | ||
"https://tg.socdm.com/aux/measured?creative_id=1093926&ctsv=CTSC&extra_field=ExtraField&family_id=512601&id=58278&loglocation_id=64919&lookupname=58278%3ASSPLOC%3A*&pos=SSPLOC&schedule_id=72115.76855.512601&seqid=SeqID&seqtime=SeqTime&xuid=XUID" | ||
] | ||
}, | ||
"ttl": 10, | ||
"w": 300 | ||
} | ||
} | ||
} | ||
], | ||
"expectedBidResponses": [ | ||
{ | ||
"currency": "JPY", | ||
"bids": [ | ||
{ | ||
"bid": { | ||
"id": "58278", | ||
"impid": "some-impression-id", | ||
"price": 46.6, | ||
"adm": "<div id=\"medibasspContainer\">\n <iframe src=\"https:\/\/s3-ap-northeast-1.amazonaws.com\/sdk-temp\/adg-sample-ad\/300x250.html?prc=-Cuepak&rd=https%3A%2F%2Ftg.socdm.com%2Frd%2Fv1%2Fz%2FhKFj2gDXY2hzbT0xOTgsZmJkZGMyNWEvNTgyNzgvU1NQTE9DLzUxMjYwMS83MjExNS43Njg1NS41MTI2MDEvMTA5MzkyNi82NDkxOS81ODI3ODpTU1BMT0M6Ki9jdD0xNTg1MjEyMDg1Nzg5O3NyPWh0dHBzO2RzcGlkPTMwMTtwcj16RGFfYVY0O3ByYj15UTtwcm89eVE7cHJvYz1KUFk7Y3JkMnk9MTA5LjQzMDAwMDAwMDAwMDAxO2NyeTJkPTAuMDA5MTM4MjYxOTAyNTg2MTI3MztpZHg9MDulc2VxaWTaACQ0NzFhM2JlNS1lYTQzLWRhZjAtYjhjZi1mNjJkNTA1N2Y5ZWOnc2VxdGltZa0xNTg1MjEyMDg1Nzg5pHh1aWS4WE52SVNNQ281bUlBQU1hN2dOUUFBQUFB%2Fp%2Fctsv%3Dm-ad226%3Bseqid%3D471a3be5-ea43-daf0-b8cf-f62d5057f9ec%3B%2Fg%2FU%3A%3Furl%3D\" style=\"border: 0px;\" width=\"300\" height=\"250\" frameborder=\"0\" scrolling=\"no\"><\/iframe>\n <\/div>\n <img src=\"https://tg.socdm.com/bc/v3?b=beaconID&xuid=XUID&ctsv=CTSV&seqid=SeqID&seqtime=SeqTime&seqctx=SeqCtx&t=.gif\" width=\"1\" height=\"1\" style=\"display:none;border:none;padding:0;margin:0;width:1px;height:1px\"/>", | ||
"crid": "Dummy_supership.jp", | ||
"w": 300, | ||
"h": 250, | ||
"dealid": "test-deal-id" | ||
}, | ||
"type": "banner" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
|
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.
@banakemi Can you please also add/modify existing JSON tests for the changes you've made in this file?
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.
@mansinahar
Thank you. I fixed it.