Skip to content

Commit

Permalink
Improve Digital adapter: add support for native ads (prebid#1746)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbartek25 authored and Dan Barnett committed May 11, 2021
1 parent fd39422 commit 8a5d0dd
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 64 deletions.
4 changes: 4 additions & 0 deletions adapters/improvedigital/improvedigital.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType,
return openrtb_ext.BidTypeVideo, nil
}

if imp.Native != nil {
return openrtb_ext.BidTypeNative, nil
}

return "", &errortypes.BadServerResponse{
Message: fmt.Sprintf("Unknown impression type for ID: \"%s\"", impID),
}
Expand Down
161 changes: 161 additions & 0 deletions adapters/improvedigital/improvedigitaltest/exemplary/native.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
{
"mockBidRequest": {
"id": "26f14780-8ef8-4f41-b70c-c4d062237df6",
"source": {
"tid": "26f14780-8ef8-4f41-b70c-c4d062237df6",
"ext": {
"schain": {
"ver": "1.0",
"complete": 1,
"nodes": [
{ "asi": "example.com", "hp": 1, "sid": "1234abc" }
]
}
}
},
"tmax": 1000,
"imp": [
{
"id": "native",
"ext": { "improvedigital": { "placementId": 1234 } },
"native": {
"request": "{\"context\":1,\"plcmttype\":1,\"eventtrackers\":[{\"event\":1,\"methods\":[1]}],\"assets\":[{\"required\":1,\"title\":{\"len\":80}},{\"required\":1,\"data\":{\"type\":2}},{\"required\":0,\"data\":{\"type\":12}},{\"required\":0,\"img\":{\"type\":3,\"wmin\":300,\"hmin\":225,\"ext\":{\"aspectratios\":[\"4:3\"]}}},{\"required\":0,\"img\":{\"type\":1,\"w\":128,\"h\":128}},{\"required\":0,\"data\":{\"type\":3}},{\"required\":0,\"data\":{\"type\":6}}]}",
"ver": "1.2"
}
}
],
"ext": {
"prebid": {
"targeting": {
"includewinners": true,
"includebidderkeys": false
}
}
},
"site": {
"publisher": { "id": "pubid" },
"page": "example.com"
},
"device": { "w": 1581, "h": 922, "ip": "1.1.1.1" },
"regs": { "ext": { "gdpr": 0 } },
"user": {
"ext": {
"consent": "XYZ"
}
}
},
"httpcalls": [
{
"expectedRequest": {
"uri": "http://localhost/pbs",
"body": {
"id": "26f14780-8ef8-4f41-b70c-c4d062237df6",
"imp": [
{
"id": "native",
"native": {
"request": "{\"context\":1,\"plcmttype\":1,\"eventtrackers\":[{\"event\":1,\"methods\":[1]}],\"assets\":[{\"required\":1,\"title\":{\"len\":80}},{\"required\":1,\"data\":{\"type\":2}},{\"required\":0,\"data\":{\"type\":12}},{\"required\":0,\"img\":{\"type\":3,\"wmin\":300,\"hmin\":225,\"ext\":{\"aspectratios\":[\"4:3\"]}}},{\"required\":0,\"img\":{\"type\":1,\"w\":128,\"h\":128}},{\"required\":0,\"data\":{\"type\":3}},{\"required\":0,\"data\":{\"type\":6}}]}",
"ver": "1.2"
},
"ext": { "improvedigital": { "placementId": 1234 } }
}
],
"site": {
"page": "example.com",
"publisher": { "id": "pubid" }
},
"device": {
"ip": "1.1.1.1",
"h": 922,
"w": 1581
},
"user": {
"ext": {
"consent": "XYZ"
}
},
"tmax": 1000,
"source": {
"tid": "26f14780-8ef8-4f41-b70c-c4d062237df6",
"ext": {
"schain": {
"ver": "1.0",
"complete": 1,
"nodes": [
{
"asi": "example.com",
"hp": 1,
"sid": "1234abc"
}
]
}
}
},
"regs": { "ext": { "gdpr": 0 } },
"ext": {
"prebid": {
"targeting": {
"includewinners": true,
"includebidderkeys": false
}
}
}
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "26f14780-8ef8-4f41-b70c-c4d062237df6",
"cur": "USD",
"seatbid": [
{
"bid": [
{
"ext": {
"improvedigital": {
"brand_name": "AdvertiserABC",
"bidder_id": 301
}
},
"crid": "14065",
"id": "d4f04449-ba04-4d7c-bb34-dc0fc5240f59",
"price": 0.01,
"adm": "{\"assets\":[{\"title\":{\"text\":\"Luxury Mars Cruises\"},\"id\":1},{\"id\":2,\"data\":{\"type\":2,\"value\":\"Visit the planet in a luxury spaceship.\"}},{\"id\":3,\"data\":{\"type\":12,\"value\":\"Book today\"}},{\"id\":4,\"img\":{\"h\":250,\"type\":3,\"url\":\"http://hb.improvedigital.com/creatives/display/300x250.jpg\",\"w\":300}},{\"id\":6,\"data\":{\"type\":3,\"value\":\"3.8\"}},{\"id\":7,\"data\":{\"type\":6,\"value\":\"FREE\"}}],\"link\":{\"clicktrackers\":[\"http://localhost.localdomain/click/\"],\"url\":\"http://www.iponweb.com/careers/\"}}",
"adomain": ["example.com"],
"impid": "native",
"cid": "25076"
}
],
"seat": "improvedigital"
}
]
}
}
}
],
"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "d4f04449-ba04-4d7c-bb34-dc0fc5240f59",
"impid": "native",
"price": 0.01,
"adm": "{\"assets\":[{\"title\":{\"text\":\"Luxury Mars Cruises\"},\"id\":1},{\"id\":2,\"data\":{\"type\":2,\"value\":\"Visit the planet in a luxury spaceship.\"}},{\"id\":3,\"data\":{\"type\":12,\"value\":\"Book today\"}},{\"id\":4,\"img\":{\"h\":250,\"type\":3,\"url\":\"http://hb.improvedigital.com/creatives/display/300x250.jpg\",\"w\":300}},{\"id\":6,\"data\":{\"type\":3,\"value\":\"3.8\"}},{\"id\":7,\"data\":{\"type\":6,\"value\":\"FREE\"}}],\"link\":{\"clicktrackers\":[\"http://localhost.localdomain/click/\"],\"url\":\"http://www.iponweb.com/careers/\"}}",
"adomain": ["example.com"],
"cid": "25076",
"crid": "14065",
"ext": {
"improvedigital": {
"brand_name": "AdvertiserABC",
"bidder_id": 301
}
}
},
"type": "native"
}
]
}
]
}
12 changes: 12 additions & 0 deletions adapters/improvedigital/improvedigitaltest/params/race/native.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"placementId": 123,
"publisherId": 321,
"placementKey": "uniq_name",
"size": {
"w": 100,
"h": 100
},
"keyValues": {
"testKey1": ["testValueA", "testValueB"]
}
}

This file was deleted.

2 changes: 2 additions & 0 deletions static/bidder-info/improvedigital.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ capabilities:
mediaTypes:
- banner
- video
- native
site:
mediaTypes:
- banner
- video
- native

0 comments on commit 8a5d0dd

Please sign in to comment.