Skip to content

Adding Events support in bid responses #1597

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

Merged
merged 20 commits into from
Jan 20, 2021
Merged

Adding Events support in bid responses #1597

merged 20 commits into from
Jan 20, 2021

Conversation

laurb9
Copy link
Contributor

@laurb9 laurb9 commented Nov 24, 2020

Implemented wurl insertion in cached bids, vast rewriting and bid.ext.prebid.events for #1015
Updated and refactored auction_test unit tests for cached bids
Updated exchange_test for bid.ext.prebid.events and vast rewriting

Test coverage

ok github.com/prebid/prebid-server/exchange 6.039s coverage: 90.5% of statements
ok github.com/prebid/prebid-server/endpoints/events 0.022s coverage: 97.4% of statements

PG is deferred to later PR (PBS-Java does not implement it either)

CC @bretg

@laurb9 laurb9 marked this pull request as draft November 24, 2020 17:38
@laurb9 laurb9 changed the title Adding Events (WIP) PBID-414, PBID-413, PBID-958 Adding Events (WIP) #1015 Nov 24, 2020
@laurb9 laurb9 changed the title Adding Events (WIP) #1015 Adding Events support in bid responses (WIP) #1015 Nov 24, 2020
@laurb9 laurb9 force-pushed the events branch 3 times, most recently from 04f7d0c to 1849877 Compare November 25, 2020 19:03
@laurb9 laurb9 force-pushed the events branch 2 times, most recently from cfc30bc to b829081 Compare December 1, 2020 21:26
- wurl insertion in cached bids
- vast modifying in video bids
This avoids unnecessary conversions between json and string

ok  	github.com/prebid/prebid-server/endpoints/events	0.034s	coverage: 96.1% of statements
@laurb9 laurb9 marked this pull request as ready for review December 1, 2020 21:39
@laurb9
Copy link
Contributor Author

laurb9 commented Dec 1, 2020

Rebased after #1532

@laurb9 laurb9 changed the title Adding Events support in bid responses (WIP) #1015 Adding Events support in bid responses #1015 Dec 4, 2020
@laurb9 laurb9 changed the title Adding Events support in bid responses #1015 Adding Events support in bid responses Dec 8, 2020
Copy link
Contributor

@SyntaxNode SyntaxNode left a comment

Choose a reason for hiding this comment

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

I didn't review the tests in detail yet. Have some other comments first.

@@ -23,6 +23,7 @@ type ExtRequestPrebid struct {
SChains []*ExtRequestPrebidSChain `json:"schains,omitempty"`
StoredRequest *ExtStoredRequest `json:"storedrequest,omitempty"`
Targeting *ExtRequestTargeting `json:"targeting,omitempty"`
Events json.RawMessage `json:"events,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be a strongly typed struct instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can, but it would be an empty struct, as the only possible value so far is events: {}.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah. Is this like caching where the presence is the trigger?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ext.prebid.cache needs a value though (vastxml and/or bids).
I expect that in time, so will ext.prebid.events, but for now it works as you said.

@@ -52,11 +52,13 @@ type IdFetcher interface {

type exchange struct {
adapterMap map[openrtb_ext.BidderName]adaptedBidder
bidderInfo adapters.BidderInfos
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need the whole info, or perhaps just a boolean lookup for if vast is enabled for the bidders?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought to keep it generic, so if we add per-channel settings later, or need to look up other bidder settings, we would not need to go back and modify the exchange struct and all the unit tests.

Performance-wise, it looks equivalent, only one map lookup is done either way to reach the value.
Let me know your thoughts.

Copy link
Contributor

Choose a reason for hiding this comment

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

I wasn't worried about performance. Thought it might be simpler to only pass the information needed. I feel 50/50 on it. I imagine we'll refactor the bidderInfo map to some kind of bidderInfoService in the future anyway. I think we might need more context after I add in hardcoded aliases.

- Fixed comments
- Removed redundant types in func proto
- Add bool parameter to `ModifyVastXmlString()` to indicate string was changed
- Decode RawMessage instead of casting to string (to handle encoded escapes)

> ok github.com/prebid/prebid-server/endpoints/events	0.039s	coverage: 97.4% of statements
When the VAST is modified to insert the event tracking tag,
the modified creative is also returned in the bid response, in addition to being cached.

Behavior currently implemented requires targeting enabled.

Also renamed eventsData->eventTracking
@laurb9
Copy link
Contributor Author

laurb9 commented Dec 10, 2020

I implemented part of the spec change mentioned here #1015 (comment) - the modified VAST creative should be returned in bid response, not only cache.

I moved the VAST rewriting from auction/doCache to exchange/HoldAuction with the associated unit test migration, as they use two different sets of json specs. There are still some unanswered questions regarding the requirement that targeting be enabled for VAST rewriting because only the winning bids are modified, or even if we should modify all the bids instead.

For now, this implementation requires targeting, until the requirements are clarified. This should be ok if most requests use GAM or some other network that needs the targeting keys anyway, so targeting would be enabled.

Also an open question regarding the PBS behavior of making up a VAST creative from the nurl if it was missing, but only to cache it, while still returning an empty adm. Combining this behavior, if intentional, with the requirement to always return modified VAST is going to be difficult. For this PR, PBS will return the modified made-up creative if it needed to be modified, and fall back to the original behavior otherwise.

- all bids have vast modified if account and bidder enabled, not just winning
- all NON-VIDEO bids have events if account or request enabled
- all cached NON-VIDEO bids have wurl patched in if account or request enabled.

prebid#1015 (comment)
Copy link
Collaborator

@bsardo bsardo left a comment

Choose a reason for hiding this comment

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

LGTM

@bsardo bsardo merged commit 994d0f0 into prebid:master Jan 20, 2021
@laurb9 laurb9 deleted the events branch February 25, 2021 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants