-
Notifications
You must be signed in to change notification settings - Fork 769
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
Events: Inject tracker if events are enabled #3803
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like exchange/exchangetest/events-vast-account-off-request-on.json
and exchange/exchangetest/events-vast-account-on-request-off.json
but, can we add unit tests for modifyBidVAST
, convertToVastEvent
, and appendURLs
in exchange/events_test.go
please?
exchange/events.go
Outdated
|
||
for _, event := range events.VASTEvents { | ||
switch event.CreateElement { | ||
// TODO: Prebid currently uses config.ExternalURL for impression tracking, decprecated in favor of config.Event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: typo in the word "deprecated"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guscarreon Add unit tests and fixed typo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this PR, can we finally enable? Or should we keep line 62 below?
60 // Events indicates the various types of events to be captured typically for injecting tracker URLs
61 // within the VAST XML
62 // Don't enable this feature. It is still under developmment. Please follow https://github.com/prebid/prebid-server/issues/1725 for more updates
63 type Events struct {
64 Enabled bool `mapstructure:"enabled" json:"enabled"`
65 DefaultURL string `mapstructure:"default_url" json:"default_url"`
66 VASTEvents []VASTEvent `mapstructure:"vast_events" json:"vast_events,omitempty"`
67 }
config/events.go
@bsardo you edited line 64 some time ago, are we ready to enable?
I'm not sure off the top of head. @Pubmatic-Dhruv-Sonone are you expecting to open additional PRs to complete this feature? |
@bsardo I will be creating new PR for Prometheus stats and moving existing impression tracker URL to event framework. |
// TODO: Prebid currently uses config.ExternalURL for impression tracking, deprecated in favor of config.Event | ||
// case config.ImpressionVASTElement: | ||
// ve.Impressions = appendURLs(ve.Impressions, event, events.DefaultURL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you're going to uncomment this when the feature is enabled, is that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently cfg.ExternalURL
is used for impression tracker And the event injection framework uses account.Event.URLS
. Either we will have to deprecated cfg.ExternalURL
and have impression as part of account.Event.URLS
or set cfg.ExternalURL
in account.Event.URLS
during processing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't deprecate a config until the next major release. In the config layer, can we have cfg.ExternalURL
be the default value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SyntaxNode Do you want to add cfg.ExternalURL
as default config only for impression tracker or all trackers events?
Currently impression trackers are added in ModifyVastXmlString
and events injector code does not add impression tracker currently as that part is commented. I was going to create a separate PR for removing ModifyVastXmlString
function and moving impression tracker injection functionality to events injector framework, there I can use cfg.ExternalURL for impression tracker inside convertToVastEvent
. If needed I can do that as part of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pubmatic-Dhruv-Sonone if it is easy to do, I would make cfg.ExternalURL
the default for all tracker events. I suggest moving forward with your plan of creating a separate PR to remove ModifyVastXmlString
with the corresponding functionality moving to the events injector framework and using cfg.ExternalURL
as the default.
} | ||
} | ||
|
||
func TestAppendURLs(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test case where urls
is nil and one where event.URLs
is nil?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -192,3 +195,296 @@ func Test_isEventAllowed(t *testing.T) { | |||
}) | |||
} | |||
} | |||
|
|||
func TestConvertToVastEvent(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add one more test case here with GeneratedBidID
set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@bsardo Addressed comments. Please check. |
Hi @Pubmatic-Dhruv-Sonone, we recently released PBS 3.0, more specifically v3.1.0, which updates Prebid Server package import references throughout the project from v2 to v3.
As a result, please merge with master (no rebase) and then ensure all Prebid Server package import references in the files you’ve changed are v3 so we can resume reviewing. Thanks! |
@bsardo Merged the latest prebid master. Please check. |
// TODO: Prebid currently uses config.ExternalURL for impression tracking, deprecated in favor of config.Event | ||
// case config.ImpressionVASTElement: | ||
// ve.Impressions = appendURLs(ve.Impressions, event, events.DefaultURL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't deprecate a config until the next major release. In the config layer, can we have cfg.ExternalURL
be the default value?
exchange/events_test.go
Outdated
expected injector.VASTEvents | ||
}{ | ||
{ | ||
name: "Error event", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: t.Run
does not allow test names to have spaces and will auto fill them in. To make it easier to associate a test failure, please do not use spaces in test names. Consider formats like error-event
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Bid: &openrtb2.Bid{ | ||
ID: "bid2", | ||
NURL: "http://nurl.com", | ||
AdM: "<VAST version=\"4.0\" xmlns=\"http://www.iab.com/VAST\"><Ad id=\"20011\" sequence=\"1\" conditionalAd=\"false\"><Wrapper followAdditionalWrappers=\"0\" allowMultipleAds=\"1\" fallbackOnNoAd=\"0\"><AdSystem version=\"4.0\"><![CDATA[iabtechlab]]></AdSystem><Error><![CDATA[http://example.com/error]]></Error><Impression id=\"Impression-ID\"><![CDATA[http://example.com/track/impression]]></Impression><Impression><![CDATA[http://example.com/event?t=imp&b=generatedBidID&a=account1&bidder=bidder2&f=b&int=integration1&ts=1234567890]]></Impression><Creatives><Creative id=\"5480\" sequence=\"1\" adId=\"2447226\"><CompanionAds><Companion id=\"1232\" width=\"100\" height=\"150\" assetWidth=\"250\" assetHeight=\"200\" expandedWidth=\"350\" expandedHeight=\"250\" apiFramework=\"VPAID\" adSlotID=\"3214\" pxratio=\"1400\"><StaticResource creativeType=\"image/png\"><![CDATA[https://www.iab.com/wp-content/uploads/2014/09/iab-tech-lab-6-644x290.png]]></StaticResource><CompanionClickThrough><![CDATA[https://iabtechlab.com]]></CompanionClickThrough><CompanionClickThrough><![CDATA[http://tracking.url]]></CompanionClickThrough><CompanionClickThrough><![CDATA[http://default.url]]></CompanionClickThrough></Companion></CompanionAds></Creative></Creatives><VASTAdTagURI><![CDATA[https://raw.githubusercontent.com/InteractiveAdvertisingBureau/VAST_Samples/master/VAST%204.0%20Samples/Inline_Companion_Tag-test.xml]]></VASTAdTagURI></Wrapper></Ad></VAST>", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the AdM for the test be simplified / slimmed down to just the essentials to make the test case clearer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Can you reduce the noise in all of the AdM
s in this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pubmatic-Dhruv-Sonone I just wanted to check in and see if all or most of the AdM
is necessary or if it can be slimmed down.
@@ -11,7 +11,7 @@ import ( | |||
) | |||
|
|||
const ( | |||
emptyAdmResponse = `<VAST version="3.0"><Ad><Wrapper><AdSystem>prebid.org wrapper</AdSystem><VASTAdTagURI><![CDATA[%s]]></VASTAdTagURI><Creatives></Creatives></Wrapper></Ad></VAST>` | |||
emptyAdmResponse = `<VAST version="3.0"><Ad><Wrapper><AdSystem>prebid.org wrapper</AdSystem><VASTAdTagURI><![CDATA[%s]]></VASTAdTagURI><Impression></Impression><Creatives></Creatives></Wrapper></Ad></VAST>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this empty tag added? What happens if this is omitted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is as per PRD to return empty Vast in case bid.Adm is empty and NURL is present.
Events PRD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to figure out how you arrived at this conclusion. In Event PRD 3.3.2. VAST Modification I see the following requirements:
Otherwise if 'adm' is empty and 'nurl' is present, create a VAST wrapper:
<VAST version=\"3.0\"><Ad><Wrapper>
<AdSystem>prebid.org wrapper</AdSystem>
<VASTAdTagURI><![CDATA[" + bidNurl + "]]></VASTAdTagURI>
<Creatives></Creatives>
</Wrapper></Ad></VAST>
And also:
Once we know what type of VAST (inline or wrapper) is present:
...
b. Wrappers
iii. If <Impression> is not present, add the <Impression> tag(s) at the end of the Wrapper element.
I'm a bit confused because I don't see this tag in some of the examples in the spec where a nurl is present.
Can you figure out what Java is doing in this scenario?
@Pubmatic-Dhruv-Sonone see my latest comments. |
No description provided.