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

Adding the passing of CCPA value to the bid request for video endpoint #1143

Merged
merged 2 commits into from
Dec 13, 2019
Merged
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
4 changes: 4 additions & 0 deletions endpoints/openrtb2/video_auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,10 @@ func mergeData(videoRequest *openrtb_ext.BidRequestVideo, bidRequest *openrtb.Bi
bidRequest.TMax = videoRequest.TMax
}

if videoRequest.Regs != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't realize you were going to add the OpenRTB Regs into the video model directly. I expected something more along the lines of the simplified user object. This is totally fine with me, but in that case you can just set the bidRequest.Regs directly to the videoRequest.Regs... provided nothing else in the OpenRTB transform is writing out Regs in which case this code is safer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the change here to setting the bidRequest.Regs directly to the regs from the videoRequest. Also updated unit test to have GDPR fields.

bidRequest.Regs = videoRequest.Regs
}

return nil
}

Expand Down
6 changes: 6 additions & 0 deletions endpoints/openrtb2/video_auction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,10 @@ func TestMergeOpenRTBToVideoRequest(t *testing.T) {
videoReq.BCat = []string{"test1", "test2"}
videoReq.BAdv = []string{"test3", "test4"}

videoReq.Regs = &openrtb.Regs{
Ext: json.RawMessage(`{"gdpr":1,"us_privacy":"1NYY","existing":"any","consent":"anyConsent"}`),
}

mergeData(videoReq, bidReq)

assert.Equal(t, videoReq.BCat, bidReq.BCat, "BCat is incorrect")
Expand All @@ -641,6 +645,8 @@ func TestMergeOpenRTBToVideoRequest(t *testing.T) {
assert.Equal(t, videoReq.Device.DNT, bidReq.Device.DNT, "Device.DNT is incorrect")

assert.Equal(t, videoReq.Site.Page, bidReq.Site.Page, "Device.Site.Page is incorrect")

assert.Equal(t, videoReq.Regs, bidReq.Regs, "Regs is incorrect")
}

func TestHandleError(t *testing.T) {
Expand Down
8 changes: 8 additions & 0 deletions openrtb_ext/bid_request_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ type BidRequestVideo struct {
// Description:
// Block list of advertisers by their domains (e.g., “ford.com”).
BAdv []string `json:"badv,omitempty"`

// Attribute:
// regs
// Type:
// object; optional
// Description:
// Contains the OpenRTB Regs object to be passed to OpenRTB request
Regs *openrtb.Regs `json:"regs,omitempty"`
}

type PodConfig struct {
Expand Down