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

Sonobi: add native support to sonobi adapter #3802

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions adapters/sonobi/sonobi.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType,
if imp.Banner == nil && imp.Video != nil {
mediaType = openrtb_ext.BidTypeVideo
}
if imp.Banner == nil && imp.Video == nil && imp.Native != nil {
mediaType = openrtb_ext.BidTypeNative
Comment on lines +143 to +144
Copy link
Contributor

Choose a reason for hiding this comment

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

Code path is not covered. Should add json framework tests for Native media type.

Copy link
Contributor

Choose a reason for hiding this comment

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

@bansawbanchee Suggesting you to please use Mtype field set by your adapter response. Here is an example -

func getBidType(bid openrtb2.Bid) (openrtb_ext.BidType, error) {
	switch bid.MType {
	case openrtb2.MarkupBanner:
		return openrtb_ext.BidTypeBanner, nil
	case openrtb2.MarkupVideo:
		return openrtb_ext.BidTypeVideo, nil
	case openrtb2.MarkupNative:
		return openrtb_ext.BidTypeNative, nil
	}

	return "", &errortypes.BadInput{
		Message: fmt.Sprintf("Could not define media type for impression: %s", bid.ImpID),
	}
}

}
return mediaType, nil
}
}
Expand Down
140 changes: 140 additions & 0 deletions adapters/sonobi/sonobitest/exemplary/native.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
{
"mockBidRequest": {
"id": "some-request-id",
"site": {
"page": "http://tester.go.sonobi.com",
"domain": "sonobi.com"
},
"device": {
"ip": "123.123.123.123"
},
"imp": [
{
"id": "some-impression-id",
"native": {
"request": "{\"ver\":\"1.2\",\"context\":1,\"contextsubtype\":11,\"plcmttype\":2,\"plcmtcnt\":3,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":1000}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":600,\"hmin\":600}},{\"id\":3,\"required\":0,\"data\":{\"type\":1,\"len\":200}},{\"id\":4,\"required\":0,\"data\":{\"type\":2,\"len\":3000}},{\"id\":5,\"required\":0,\"data\":{\"type\":6,\"len\":60}},{\"id\":6,\"required\":0,\"data\":{\"type\":500}},{\"id\":10,\"required\":0,\"data\":{\"type\":12,\"len\":15}}],\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"privacy\":1}",
"ver": "1.2",
"battr": [
1,
2,
6,
7,
8,
9,
10,
14
]
},
"ext": {
"bidder": {
"TagID": "/7780971/apex_3pdm_integration"
}
}
}
],
"test": 1,
"tmax": 500
},
"httpCalls": [
{
"expectedRequest": {
"headers": {
"Accept": [
"application/json"
],
"Content-Type": [
"application/json;charset=utf-8"
]
},
"uri": "https://apex.go.sonobi.com/prebid?partnerid=71d9d3d8af",
"body": {
"id": "some-request-id",
"imp": [
{
"id": "some-impression-id",
"native": {
"request": "{\"ver\":\"1.2\",\"context\":1,\"contextsubtype\":11,\"plcmttype\":2,\"plcmtcnt\":3,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":1000}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":600,\"hmin\":600}},{\"id\":3,\"required\":0,\"data\":{\"type\":1,\"len\":200}},{\"id\":4,\"required\":0,\"data\":{\"type\":2,\"len\":3000}},{\"id\":5,\"required\":0,\"data\":{\"type\":6,\"len\":60}},{\"id\":6,\"required\":0,\"data\":{\"type\":500}},{\"id\":10,\"required\":0,\"data\":{\"type\":12,\"len\":15}}],\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"privacy\":1}",
"ver": "1.2",
"battr": [
1,
2,
6,
7,
8,
9,
10,
14
]
},
"tagid": "/7780971/apex_3pdm_integration",
"ext": {
"bidder": {
"TagID": "/7780971/apex_3pdm_integration"
}
}
}
],
"site": {
"domain": "sonobi.com",
"page": "http://tester.go.sonobi.com"
},
"device": {
"ip": "123.123.123.123"
},
"test": 1,
"tmax": 500
},
"impIDs": [
"some-impression-id"
]
},
"mockResponse": {
"status": 200,
"body": {
"id": "some-request-id",
"seatbid": [
{
"bid": [
{
"id": "1",
"impid": "some-impression-id",
"price": 2.8649999999999998,
"adm": "{\"ver\":\"1.2\",\"assets\":[{\"id\":1,\"title\":{\"text\":\"sonobi native test\"}},{\"id\":2,\"img\":{\"url\":\"https://sonobi.com/creatives/88253568_opt?v=v1.8\",\"w\":1200,\"h\":627}},{\"id\":3,\"data\":{\"value\":\"sonobi.native\"}},{\"id\":12,\"img\":{\"url\":\"https://sonobi.com/creatives/88233511_opt?v=v1.8\",\"w\":289,\"h\":289}},{\"id\":9,\"data\":{\"value\":\"5\"}}],\"link\":{\"url\":\"https://sonobi.com/click/QJZuSq1rx3qBu2iR22GBkRhod-7fXskHgy_x3_lJS5ugx3VFkZdy95Z0Tfr70G7Bh_67UxsAh4XBZAUmDHbECmTmLTyUhkOm-ijGH0VCBO3klFS7Nh_gLcyO7vQip8WRmLNWr0AZN5IAJqahFGica2i57JEKq7iunZOE6tfusHjYssR5z9hq3kVKUjt87B8OTb_0EaWTRsHEoPrUnPqlNiQFWvoCoSJglK0KTVA7zqg04sm-IOtJHtsHDCjSJORBA_cRynIDC2sLIYD8lH4NwGZ6nk29X9W6VeiMUss91wbtMxktqMSEmFcwCXMgL41xAxrVz4m7GasC9Oa6MoF023a21xDI5Qee6N3D-CAm-2O2RI78hrNsnsxZt6FJr2r9V3mTBlqtqredd49sCzbJ86k-SJ8gQFhqQNulDTMKZv-pvWahu79WzjRSEjQkR8ondCmveXxuNxcQM0Is2IPdHoBUQmT5vW_NfeN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Pzm6pkp2TXDkJMQ81FZ4RxXGChf1IpKzM-MYBXnyqddDiVd2fH0PGw6Ow9FJROF3Ptca-hgi3-f-_BqayiL0jyAR0N36OkYW7Y9iZ-YXNExevL3kuZ7pEUi00-tBsrccrWJnq3O6Yy8dcY-mTrfSaiG3WhzlwT9XRY1IzQH3hK9JzCj1D2Lcdtxdq2JBlfcazZf-pSPrTEhJSRXb80G//https://app.appsflyer.com/1136397354?advertising_id=efda5faa-e37b-4d56-9c16-7d93c1bf8dbc\\u0026af_ad=Native+%231+-+New+Offer\\u0026af_ad_id=88253487\\u0026af_adset=86452228_281940292\\u0026af_adset_id=s86452228_msonobi_b281940292_l88334685_c88253487_a88233515_ab900\\u0026af_c_id=88233526\\u0026af_channel=edge_int\\u0026af_click_lookback=7d\\u0026af_ip=\\u0026af_lang=en\\u0026af_media_type=app\\u0026af_model=Apple+iPhone\\u0026af_os_version=iOS_17\\u0026af_pid=88233515\\u0026af_siteid=281940292\\u0026af_sub1=b4223554-0cb9-4f34-900c-220d8eaa88ef-1\\u0026af_sub_siteid=\\u0026af_ua=Mozilla%2F5.0+%28iPhone%3B+CPU+iPhone+OS+17_5_1+like+Mac+OS+X%29+AppleWebKit%2F605.1.15+%28KHTML%2C+like+Gecko%29+Mobile%2F15E148\\u0026c=Edge226_iOS\\u0026clickid=b4223554-0cb9-4f34-900c-220d8eaa88ef-1\\u0026idfa=efda5faa-e37b-4d56-9c16-7d93c1bf8dbc\\u0026pid=edge_int\",\"clicktrackers\":[\"https://iad-2.go.sonobi.com/native.gif?evt=500\\u0026iid=1724170411_f50c91bcb20e5f97ba7db96b7193a873\\u0026pid=9a1db44c9c\"]},\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"https://iad-2.go.sonobi.com/native.gif?eid=2-3\\u0026evt=504\\u0026iid=1724170411_f50c91bcb20e5f97ba7db96b7193a873\\u0026pid=9a1db44c9c\"},{\"event\":2,\"method\":1,\"url\":\"https://iad-2.go.sonobi.com/native.gif?evt=505\\u0026iid=1724170411_f50c91bcb20e5f97ba7db96b7193a873\\u0026pid=9a1db44c9c\"}]}\n",
"adomain": [
"sonobi.com"
],
"cid": "house",
"crid": "sandbox"
}
],
"seat": "sonobi"
}
],
"bidid": "sandbox_642305097",
"cur": "USD"
}
}
}
],
"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "1",
"impid": "some-impression-id",
"price": 2.8649999999999998,
"adm": "{\"ver\":\"1.2\",\"assets\":[{\"id\":1,\"title\":{\"text\":\"sonobi native test\"}},{\"id\":2,\"img\":{\"url\":\"https://sonobi.com/creatives/88253568_opt?v=v1.8\",\"w\":1200,\"h\":627}},{\"id\":3,\"data\":{\"value\":\"sonobi.native\"}},{\"id\":12,\"img\":{\"url\":\"https://sonobi.com/creatives/88233511_opt?v=v1.8\",\"w\":289,\"h\":289}},{\"id\":9,\"data\":{\"value\":\"5\"}}],\"link\":{\"url\":\"https://sonobi.com/click/QJZuSq1rx3qBu2iR22GBkRhod-7fXskHgy_x3_lJS5ugx3VFkZdy95Z0Tfr70G7Bh_67UxsAh4XBZAUmDHbECmTmLTyUhkOm-ijGH0VCBO3klFS7Nh_gLcyO7vQip8WRmLNWr0AZN5IAJqahFGica2i57JEKq7iunZOE6tfusHjYssR5z9hq3kVKUjt87B8OTb_0EaWTRsHEoPrUnPqlNiQFWvoCoSJglK0KTVA7zqg04sm-IOtJHtsHDCjSJORBA_cRynIDC2sLIYD8lH4NwGZ6nk29X9W6VeiMUss91wbtMxktqMSEmFcwCXMgL41xAxrVz4m7GasC9Oa6MoF023a21xDI5Qee6N3D-CAm-2O2RI78hrNsnsxZt6FJr2r9V3mTBlqtqredd49sCzbJ86k-SJ8gQFhqQNulDTMKZv-pvWahu79WzjRSEjQkR8ondCmveXxuNxcQM0Is2IPdHoBUQmT5vW_NfeNGdArI72iTEQCh1YpOqBSwHzxT8lCrgUc2RlgQBaPYLWt-YOfZGctdu7YkzREoM4rOrwjjhXqiBlU5eApSGFivPaTZ5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R0N36OkYW7Y9iZ-YXNExevL3kuZ7pEUi00-tBsrccrWJnq3O6Yy8dcY-mTrfSaiG3WhzlwT9XRY1IzQH3hK9JzCj1D2Lcdtxdq2JBlfcazZf-pSPrTEhJSRXb80G//https://app.appsflyer.com/1136397354?advertising_id=efda5faa-e37b-4d56-9c16-7d93c1bf8dbc\\u0026af_ad=Native+%231+-+New+Offer\\u0026af_ad_id=88253487\\u0026af_adset=86452228_281940292\\u0026af_adset_id=s86452228_msonobi_b281940292_l88334685_c88253487_a88233515_ab900\\u0026af_c_id=88233526\\u0026af_channel=edge_int\\u0026af_click_lookback=7d\\u0026af_ip=\\u0026af_lang=en\\u0026af_media_type=app\\u0026af_model=Apple+iPhone\\u0026af_os_version=iOS_17\\u0026af_pid=88233515\\u0026af_siteid=281940292\\u0026af_sub1=b4223554-0cb9-4f34-900c-220d8eaa88ef-1\\u0026af_sub_siteid=\\u0026af_ua=Mozilla%2F5.0+%28iPhone%3B+CPU+iPhone+OS+17_5_1+like+Mac+OS+X%29+AppleWebKit%2F605.1.15+%28KHTML%2C+like+Gecko%29+Mobile%2F15E148\\u0026c=Edge226_iOS\\u0026clickid=b4223554-0cb9-4f34-900c-220d8eaa88ef-1\\u0026idfa=efda5faa-e37b-4d56-9c16-7d93c1bf8dbc\\u0026pid=edge_int\",\"clicktrackers\":[\"https://iad-2.go.sonobi.com/native.gif?evt=500\\u0026iid=1724170411_f50c91bcb20e5f97ba7db96b7193a873\\u0026pid=9a1db44c9c\"]},\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"https://iad-2.go.sonobi.com/native.gif?eid=2-3\\u0026evt=504\\u0026iid=1724170411_f50c91bcb20e5f97ba7db96b7193a873\\u0026pid=9a1db44c9c\"},{\"event\":2,\"method\":1,\"url\":\"https://iad-2.go.sonobi.com/native.gif?evt=505\\u0026iid=1724170411_f50c91bcb20e5f97ba7db96b7193a873\\u0026pid=9a1db44c9c\"}]}\n",
"adomain": [
"sonobi.com"
],
"cid": "house",
"crid": "sandbox"
},
"type": "native"
}
]
}
]
}
5 changes: 5 additions & 0 deletions static/bidder-info/sonobi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ capabilities:
mediaTypes:
- banner
- video
- native
app:
mediaTypes:
- banner
- video
- native
userSync:
iframe:
url: "https://sync.go.sonobi.com/uc.html?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&loc={{.RedirectURL}}"
userMacro: "[UID]"
Copy link
Contributor

Choose a reason for hiding this comment

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

usersync works.

redirect:
url: "https://sync.go.sonobi.com/us.gif?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&loc={{.RedirectURL}}"
userMacro: "[UID]"
Loading