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

Adnuntius: Read device information from ortb Request #2112

Merged
merged 28 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
90adf68
Making adnuntius bidder working.
mikael-lundin Sep 13, 2021
8b5bb30
Testing that container works.
mikael-lundin Sep 14, 2021
2ef05d3
Tests work but fail.
mikael-lundin Sep 22, 2021
57f824e
Tzo added to the request.
mikael-lundin Sep 23, 2021
ef6d3b7
Tests for adnuntius adapter.
mikael-lundin Sep 24, 2021
c21586a
Gdpr Added to adapter.
mikael-lundin Sep 24, 2021
b5d7833
Merge pull request #1 from Adnuntius/consent
mikael-lundin Sep 24, 2021
2825270
Fixing commented issues in pull request.
mikael-lundin Oct 5, 2021
9444bff
Making adnuntius bidder working.
mikael-lundin Sep 13, 2021
82ddf79
Testing that container works.
mikael-lundin Sep 14, 2021
524d0b3
Tests work but fail.
mikael-lundin Sep 22, 2021
41bf3ff
Tzo added to the request.
mikael-lundin Sep 23, 2021
cbddd69
Tests for adnuntius adapter.
mikael-lundin Sep 24, 2021
25fefef
Gdpr Added to adapter.
mikael-lundin Sep 24, 2021
a651cce
Fixing commented issues in pull request.
mikael-lundin Oct 5, 2021
6c5fe81
Changes made in response to comments in pull request.
mikael-lundin Oct 14, 2021
176ef4b
Merge branch 'master' of github.com:Adnuntius/prebid-server
mikael-lundin Oct 14, 2021
e4a5700
Adding constants.
mikael-lundin Oct 14, 2021
6f8ee16
Validation issue fixed.
mikael-lundin Oct 14, 2021
2f3b0b7
Adding handling of 400 error, removing timezone file.
mikael-lundin Oct 14, 2021
f1682e1
Changed from errortypes.BadInput to errortypes.BadServerResponse.
mikael-lundin Oct 19, 2021
0426a7e
Merge remote-tracking branch 'upstream/master'
mikael-lundin Oct 28, 2021
1aedd36
Made changes based on comments
mikael-lundin Oct 28, 2021
5838ca3
Changed error type to Bad input for url-parsing.
mikael-lundin Oct 29, 2021
5ef3a4a
Merge remote-tracking branch 'upstream/master'
mikael-lundin Dec 13, 2021
6e65700
Sending IP address and user agent with the device request.
mikael-lundin Dec 15, 2021
839b132
Fixing test url for send-header-information.json
mikael-lundin Dec 15, 2021
63553da
Added check for headers in test.
mikael-lundin Dec 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions adapters/adnuntius/adnuntius.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,19 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E
return a.generateRequests(*request)
}

func setHeaders() http.Header {
func setHeaders(ortbRequest openrtb2.BidRequest) http.Header {

headers := http.Header{}
headers.Add("Content-Type", "application/json;charset=utf-8")
headers.Add("Accept", "application/json")
if ortbRequest.Device != nil {
if ortbRequest.Device.IP != "" {
headers.Add("X-Forwarded-For", ortbRequest.Device.IP)
}
if ortbRequest.Device.UA != "" {
headers.Add("user-agent", ortbRequest.Device.UA)
}
}
return headers
}

Expand Down Expand Up @@ -113,7 +122,7 @@ func makeEndpointUrl(ortbRequest openrtb2.BidRequest, a *adapter) (string, []err
func (a *adapter) generateRequests(ortbRequest openrtb2.BidRequest) ([]*adapters.RequestData, []error) {
var requestData []*adapters.RequestData
networkAdunitMap := make(map[string][]adnAdunit)
headers := setHeaders()
headers := setHeaders(ortbRequest)

endpoint, err := makeEndpointUrl(ortbRequest, a)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"mockBidRequest": {
"id": "test-request-id",
"user": {
"id": "1kjh3429kjh295jkl",
"ext": {
"consent": "CONSENT_STRING"
}
},
"device": {
"ip": "158.174.81.143",
"ua": "Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Mobile Safari/537.36"
},
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
},
{
"w": 300,
"h": 600
}
]
},
"ext": {
"bidder": {
"auId": "123"
}
}
}
]
},

"httpCalls": [
{
"expectedRequest": {
"headers": {
"Content-Type": [
"application/json;charset=utf-8"
],
"Accept": [
"application/json"
],
"X-Forwarded-For": [
"158.174.81.143"
],
"User-Agent": [
"Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Mobile Safari/537.36"
]
},
"uri": "http://whatever.url?format=json&tzo=0",
VeronikaSolovei9 marked this conversation as resolved.
Show resolved Hide resolved
"body": {
"adUnits": [
{
"auId": "123",
"targetId": "123-test-imp-id"
}
],
"metaData": {
"usi": "1kjh3429kjh295jkl"
},
"context": "unknown"
}
},
"mockResponse": {
"status": 200,
"body": {
"adUnits": [
{
"auId": "0000000000000123",
"targetId": "123-test-imp-id",
"html": "<ADCODE>",
"responseId": "adn-rsp-900646517",
"ads": [
{
"destinationUrls": {
"url": "http://www.google.com"
},
"bid": {
"amount": 20.0,
"currency": "NOK"
},
"adId": "adn-id-1559784094",
"creativeWidth": "980",
"creativeHeight": "240",
"creativeId": "jn9hpzvlsf8cpdmm",
"lineItemId": "q7y9qm5b0xt9htrv"
}
]
}
]
}
}
}
],
"expectedBidResponses": [
{
"bids": [
{
"bid": {
"id": "adn-id-1559784094",
"impid": "test-imp-id",
"price": 20000,
"adm": "<ADCODE>",
"adid": "adn-id-1559784094",
"adomain": ["google.com"],
"cid": "q7y9qm5b0xt9htrv",
"crid": "jn9hpzvlsf8cpdmm",
"w": 980,
"h": 240
},
"type": "banner"
}
],
"currency": "NOK"
}
]
}