Skip to content

Commit

Permalink
ext.prebid.events now overrides server config
Browse files Browse the repository at this point in the history
VAST is modified if *either* account or request setting demanded it.

prebid#1015 (comment)
  • Loading branch information
laurb9 committed Jan 6, 2021
1 parent 5f3018a commit 6377bd0
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 1 deletion.
2 changes: 1 addition & 1 deletion exchange/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (ev *eventTracking) modifyBidsForEvents(seatBids map[openrtb_ext.BidderName

// isModifyingVASTXMLAllowed returns true if this bidder config allows modifying VAST XML for event tracking
func (ev *eventTracking) isModifyingVASTXMLAllowed(bidderName string) bool {
return ev.bidderInfos[bidderName].ModifyingVastXmlAllowed && ev.enabledForAccount
return ev.bidderInfos[bidderName].ModifyingVastXmlAllowed && (ev.enabledForAccount || ev.enabledForRequest)
}

// modifyBidVAST injects event Impression url if needed, otherwise returns original VAST string
Expand Down
163 changes: 163 additions & 0 deletions exchange/exchangetest/events-vast-account-off-request-on.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
{
"events_enabled": false,
"start_time_ms": 1234567890,
"incomingRequest": {
"ortbRequest": {
"id": "some-request-id",
"app": {
"id": "some-app"
},
"imp": [
{
"id": "my-imp-id",
"video": {},
"ext": {
"appnexus": {
"placementId": 1
},
"audienceNetwork": {
"placementId": 1
}
}
}
],
"ext": {
"prebid": {
"targeting": {
"includewinners": true,
"includebidderkeys": false
},
"events": {}
}
}
}
},
"outgoingRequests": {
"appnexus": {
"modifyingVastXmlAllowed": true,
"mockResponse": {
"pbsSeatBid": {
"pbsBids": [
{
"ortbBid": {
"id": "winning-bid",
"nurl": "http://domain.com/winning-bid",
"impid": "my-imp-id",
"price": 0.71,
"w": 200,
"h": 250,
"crid": "creative-1"
},
"bidType": "video"
},
{
"ortbBid": {
"id": "losing-bid",
"nurl": "http://domain.com/losing-bid",
"impid": "my-imp-id",
"price": 0.21,
"w": 200,
"h": 250,
"crid": "creative-2"
},
"bidType": "video"
}
]
}
}
},
"audienceNetwork": {
"modifyingVastXmlAllowed": false,
"mockResponse": {
"pbsSeatBid": {
"pbsBids": [
{
"ortbBid": {
"id": "contending-bid",
"nurl": "http://domain.com/contending-bid",
"impid": "my-imp-id",
"price": 0.51,
"w": 200,
"h": 250,
"crid": "creative-4"
},
"bidType": "video"
}
]
}
}
}
},
"response": {
"bids": {
"id": "some-request-id",
"seatbid": [
{
"seat": "audienceNetwork",
"bid": [
{
"id": "contending-bid",
"nurl": "http://domain.com/contending-bid",
"impid": "my-imp-id",
"price": 0.51,
"w": 200,
"h": 250,
"crid": "creative-4",
"ext": {
"prebid": {
"type": "video"
}
}
}
]
},
{
"seat": "appnexus",
"bid": [
{
"id": "winning-bid",
"adm": "<VAST version=\"3.0\"><Ad><Wrapper><AdSystem>prebid.org wrapper</AdSystem><VASTAdTagURI><![CDATA[http://domain.com/winning-bid]]></VASTAdTagURI><Impression><![CDATA[http://localhost/event?t=imp&b=winning-bid&a=testaccount&bidder=appnexus&f=b&ts=1234567890]]></Impression><Creatives></Creatives></Wrapper></Ad></VAST>",
"nurl": "http://domain.com/winning-bid",
"impid": "my-imp-id",
"price": 0.71,
"w": 200,
"h": 250,
"crid": "creative-1",
"ext": {
"prebid": {
"type": "video",
"targeting": {
"hb_bidder": "appnexus",
"hb_cache_host": "www.pbcserver.com",
"hb_cache_path": "/pbcache/endpoint",
"hb_env": "mobile-app",
"hb_pb": "0.70",
"hb_size": "200x250"
}
}
}
},
{
"id": "losing-bid",
"adm": "<VAST version=\"3.0\"><Ad><Wrapper><AdSystem>prebid.org wrapper</AdSystem><VASTAdTagURI><![CDATA[http://domain.com/losing-bid]]></VASTAdTagURI><Impression><![CDATA[http://localhost/event?t=imp&b=losing-bid&a=testaccount&bidder=appnexus&f=b&ts=1234567890]]></Impression><Creatives></Creatives></Wrapper></Ad></VAST>",
"nurl": "http://domain.com/losing-bid",
"impid": "my-imp-id",
"price": 0.21,
"w": 200,
"h": 250,
"crid": "creative-2",
"ext": {
"prebid": {
"type": "video"
}
}
}
]
}
]
},
"prebid": {
"auctiontimestamp": 1234567890
}
}
}

0 comments on commit 6377bd0

Please sign in to comment.