-
Notifications
You must be signed in to change notification settings - Fork 5
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
OTT-130: Injecting Video Tracking Events in VAST #130
Conversation
…t trackers in VAST
endpoints/events/vtrack.go
Outdated
} | ||
} | ||
// replace standard macros | ||
eventURL = replaceMacro(eventURL, VASTAdTypeMacro, "") |
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.
add the value for ad type
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. Passing video type always
endpoints/events/vtrack.go
Outdated
if "" == strings.Trim(trackerURL, " ") { | ||
return eventURLMap | ||
} | ||
for _, event := range []string{"firstQuartile", "midpoint", "thirdQuartile", "complete"} { |
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.
Move it to global private variable
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. introduced global private variable - trackingEvents
endpoints/events/vtrack_test.go
Outdated
}, | ||
want: want{ | ||
eventURLs: map[string][]string{ | ||
"firstQuartile": []string{"http://something.com", "http://company.tracker.com?eventId=1004&appbundle=abc"}, |
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.
Add missing expectations for midpoint, thirdQuartile and complete
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. added required assertions
"complete": {"http://company.tracker.com?eventId=6&appbundle=abc"}, | ||
}, | ||
}, | ||
}, |
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.
Add testcase when adm="" but we have nurl
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
exchange/events.go
Outdated
fmt.Println(string(newVastXML)) | ||
fmt.Println(bid.AdM) |
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.
Remove println
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
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.
Once changes are done, Please go ahead with QADrop.
endpoints/events/vtrack.go
Outdated
creatives = append(creatives, doc.FindElements("VAST/Ad/InLine/Creatives/Creative/NonLinearAds")...) | ||
creatives = append(creatives, doc.FindElements("VAST/Ad/Wrapper/Creatives/Creative/NonLinearAds")...) | ||
|
||
if "" == strings.Trim(bid.AdM, " ") || strings.HasPrefix(strings.TrimLeft(strings.TrimRight(bid.AdM, "]]>"), "<![CDATA["), "http") { |
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.
- use strings.TrimSpace() instead of strings.Trim()
- bid.AdM never comes inside CDATA Tag if it is returning VAST Tag URL. check trimmed bid.AdM starts with http
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
endpoints/events/vtrack.go
Outdated
if nil != err { | ||
err := fmt.Sprintf("Error parsing VAST XML. '%v'", err.Error()) | ||
glog.Errorf(err) | ||
return []byte(vastXML), false, errors.New(err) // false indicates events trackers are not injected |
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.
return err itself
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
endpoints/events/vtrack.go
Outdated
doc := etree.NewDocument() | ||
err := doc.ReadFromString(vastXML) | ||
if nil != err { | ||
err := fmt.Sprintf("Error parsing VAST XML. '%v'", err.Error()) |
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.
fmt.Errorf use instead Sprintf
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
@@ -302,3 +329,147 @@ func ModifyVastXmlJSON(externalUrl string, data json.RawMessage, bidid, bidder, | |||
} | |||
return json.RawMessage(vast) | |||
} | |||
|
|||
//InjectVideoEventTrackers injects the video tracking events |
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.
write parameter single line description
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
endpoints/events/vtrack.go
Outdated
// replace standard macros | ||
eventURL = replaceMacro(eventURL, VASTAdTypeMacro, string(openrtb_ext.BidTypeVideo)) | ||
if nil != req && nil != req.App { | ||
eventURL = replaceMacro(eventURL, VASTAppBundleMacro, req.App.Bundle) |
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.
Check Macro here, Domain or Bundle
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.
[DOMAIN] will be req.App.Bundle in case of Apps
endpoints/events/vtrack.go
Outdated
} | ||
|
||
func replaceMacro(trackerURL, macro, value string) string { | ||
if strings.HasPrefix(macro, "[") && strings.HasSuffix(macro, "]") && len(strings.Trim(value, " ")) > 0 { |
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.
will it replace " [MACRO] "? Check with trimmed 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.
Added TrimSpace
exchange/auction.go
Outdated
if adm == "" { | ||
return fmt.Sprintf(wrapperVASTTemplate, bid.NURL) // set nurl as VASTAdTagURI | ||
} | ||
if strings.HasPrefix(adm, "<![CDATA[") { |
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.
adm won't have CDATA
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.
Removed the block
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.
👍
* OTT-130: Injecting Video Tracking Events in VAST (#130) * OTT-105_VCR: basic changes * OTT-105: Changes for injecting Tracking Events * OTT-130_VCR: Added framework with unit tests for injecting Video Event trackers in VAST * OTT-130_VCR: Reverted Path replace * OTT-130: Replaced etree dep with original repository * OTT-130: Refactored as per latest master * OTT-130: Refactored * OTT-130: Refactored * OTT-130: Reverted unwanted changes * OTT-130: Added unit tests and refactoring * OTT-130: InjectVideoEventTrackers will now return error if any * OTT-130: Refactored * OTT-130: Removed custom macro support * OTT-130: Reverted the unwanted changes * OTT-130: Reverted unwanted changes * OTT-130: Added Url Query Escape Functionality * OTT-130: Fixed test failures * OTT-130: Refactored * OTT-130: Addressed code review comments from Viral Co-authored-by: Shriprasad <[email protected]> * OTT-131: VCR Custom Macro (#132) * OTT-131: Added support for consuming the custom macros from host company * OTT-131: Removed unwanted comments * OTT-131: Addressed code review comments Co-authored-by: Shriprasad <[email protected]> * OTT-174: Added bid ID , Ad Unit as tracking parameters and ADomain handling change (#134) * OTT-174: Added AdUnit parameter inside video event tracker URL * OTT-174: Added bid id, au tracker parameters. in case of advetiser_id, OW will now send only value at index 0 from bid.ADomain array by extracting the domain Also handled the CTV/Ad Pod bid.id custom use case * OTT-174: Ensured bidid value is replaced only in case of OW trackers. (95% reliable) Also ensured that bidid is not getting added to other trackers, if not present * OTT-174: Fixed code review comments Co-authored-by: Shriprasad <[email protected]> Co-authored-by: Shriprasad <[email protected]>
* OTT-130: Injecting Video Tracking Events in VAST (#130) * OTT-105_VCR: basic changes * OTT-105: Changes for injecting Tracking Events * OTT-130_VCR: Added framework with unit tests for injecting Video Event trackers in VAST * OTT-130_VCR: Reverted Path replace * OTT-130: Replaced etree dep with original repository * OTT-130: Refactored as per latest master * OTT-130: Refactored * OTT-130: Refactored * OTT-130: Reverted unwanted changes * OTT-130: Added unit tests and refactoring * OTT-130: InjectVideoEventTrackers will now return error if any * OTT-130: Refactored * OTT-130: Removed custom macro support * OTT-130: Reverted the unwanted changes * OTT-130: Reverted unwanted changes * OTT-130: Added Url Query Escape Functionality * OTT-130: Fixed test failures * OTT-130: Refactored * OTT-130: Addressed code review comments from Viral Co-authored-by: Shriprasad <[email protected]> * OTT-131: VCR Custom Macro (#132) * OTT-131: Added support for consuming the custom macros from host company * OTT-131: Removed unwanted comments * OTT-131: Addressed code review comments Co-authored-by: Shriprasad <[email protected]> * OTT-174: Added bid ID , Ad Unit as tracking parameters and ADomain handling change (#134) * OTT-174: Added AdUnit parameter inside video event tracker URL * OTT-174: Added bid id, au tracker parameters. in case of advetiser_id, OW will now send only value at index 0 from bid.ADomain array by extracting the domain Also handled the CTV/Ad Pod bid.id custom use case * OTT-174: Ensured bidid value is replaced only in case of OW trackers. (95% reliable) Also ensured that bidid is not getting added to other trackers, if not present * OTT-174: Fixed code review comments Co-authored-by: Shriprasad <[email protected]> * OTT-105: Changes for advertiser id Co-authored-by: Shriprasad <[email protected]>
No description provided.