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

Dailymotion bid adapter: Process both ORTB2 sources of category #12279

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
10 changes: 6 additions & 4 deletions modules/dailymotionBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ function getVideoMetadata(bidRequest, bidderRequest) {

// As per oRTB 2.5 spec, "A bid request must not contain both an App and a Site object."
// See section 3.2.14
const siteOrAppObj = deepAccess(bidderRequest, 'ortb2.site')
? deepAccess(bidderRequest, 'ortb2.site')
: deepAccess(bidderRequest, 'ortb2.app');
// Content object is either from Object: Site or Object: App
const contentObj = deepAccess(bidderRequest, 'ortb2.site')
? deepAccess(bidderRequest, 'ortb2.site.content')
: deepAccess(bidderRequest, 'ortb2.app.content');
const contentObj = deepAccess(siteOrAppObj, 'content')

const parsedContentData = {
// Store as object keys to ensure uniqueness
Expand Down Expand Up @@ -70,7 +71,8 @@ function getVideoMetadata(bidRequest, bidderRequest) {
? videoParams.isCreatedForKids
: null,
context: {
siteOrAppCat: deepAccess(contentObj, 'cat', []),
siteOrAppCat: deepAccess(siteOrAppObj, 'cat', []),
siteOrAppContentCat: deepAccess(contentObj, 'cat', []),
videoViewsInSession: (
typeof videoParams.videoViewsInSession === 'number' &&
videoParams.videoViewsInSession >= 0
Expand Down
7 changes: 6 additions & 1 deletion test/spec/modules/dailymotionBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ describe('dailymotionBidAdapterTests', () => {
isCreatedForKids: bidRequestData[0].params.video.isCreatedForKids,
context: {
siteOrAppCat: [],
siteOrAppContentCat: [],
videoViewsInSession: bidRequestData[0].params.video.videoViewsInSession,
autoplay: bidRequestData[0].params.video.autoplay,
playerName: bidRequestData[0].params.video.playerName,
Expand Down Expand Up @@ -1551,6 +1552,7 @@ describe('dailymotionBidAdapterTests', () => {
isCreatedForKids: null,
context: {
siteOrAppCat: [],
siteOrAppContentCat: [],
videoViewsInSession: null,
autoplay: null,
playerName: 'dailymotion',
Expand Down Expand Up @@ -1605,6 +1607,7 @@ describe('dailymotionBidAdapterTests', () => {
coppa: 0,
},
site: {
cat: ['IAB-1'],
content: {
id: '54321',
language: 'FR',
Expand Down Expand Up @@ -1729,7 +1732,8 @@ describe('dailymotionBidAdapterTests', () => {
livestream: !!bidderRequestData.ortb2.site.content.livestream,
isCreatedForKids: bidRequestData[0].params.video.isCreatedForKids,
context: {
siteOrAppCat: bidderRequestData.ortb2.site.content.cat,
siteOrAppCat: bidderRequestData.ortb2.site.cat,
siteOrAppContentCat: bidderRequestData.ortb2.site.content.cat,
videoViewsInSession: bidRequestData[0].params.video.videoViewsInSession,
autoplay: bidRequestData[0].params.video.autoplay,
playerName: bidRequestData[0].params.video.playerName,
Expand Down Expand Up @@ -1821,6 +1825,7 @@ describe('dailymotionBidAdapterTests', () => {
isCreatedForKids: null,
context: {
siteOrAppCat: [],
siteOrAppContentCat: [],
videoViewsInSession: null,
autoplay: null,
playerName: '',
Expand Down