Skip to content

Commit

Permalink
Dailymotion Bid Adaptor: get iabcats from ortb2.site.content.data
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Siow committed Apr 18, 2024
1 parent cff7c34 commit b399158
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
16 changes: 11 additions & 5 deletions modules/dailymotionBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@ function getVideoMetadata(bidRequest, bidderRequest) {
const videoMetadata = {
description: videoParams.description || '',
duration: videoParams.duration || 0,
iabcat1: deepAccess(bidderRequest, 'ortb2.site.content.cat', [])
iabcat1: deepAccess(bidderRequest, 'ortb2.site.content.data', [])
// Only take IAB cats of taxonomy V1
.filter(cat => cat.toLowerCase().indexOf('iab-') === 0),
// See https://docs.prebid.org/features/firstPartyData.html#segments-and-taxonomy
.filter(data => data?.ext?.segtax === 4)
.map(data => (Array.isArray(data?.segment) ? data.segment : []).map(seg => seg.id))
.flat(1),
iabcat2: Array.isArray(videoParams.iabcat2)
? videoParams.iabcat2
// Only take IAB cats of taxonomy V2 or higher by excluding "IAB-" type categories
: deepAccess(bidderRequest, 'ortb2.site.content.cat', [])
.filter(cat => cat.toLowerCase().indexOf('iab-') !== 0),
: deepAccess(bidderRequest, 'ortb2.site.content.data', [])
// Only take IAB cats of taxonomy V2 or higher
// See https://docs.prebid.org/features/firstPartyData.html#segments-and-taxonomy
.filter(data => [5, 6, 7].includes(data?.ext?.segtax))
.map(data => (Array.isArray(data?.segment) ? data.segment : []).map(seg => seg.id))
.flat(1),
id: videoParams.id || '',
lang: videoParams.lang || '',
private: videoParams.private || false,
Expand Down
28 changes: 25 additions & 3 deletions test/spec/modules/dailymotionBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,18 @@ describe('dailymotionBidAdapterTests', () => {
},
site: {
content: {
cat: ['IAB-1', '200'],
data: [
{
name: 'dataprovider.com',
ext: { segtax: 4 },
segment: [{ id: 'IAB-1' }],
},
{
name: 'dataprovider.com',
ext: { segtax: 5 },
segment: [{ id: '200' }],
},
],
},
},
},
Expand Down Expand Up @@ -171,7 +182,18 @@ describe('dailymotionBidAdapterTests', () => {
},
site: {
content: {
cat: ['6', '17'],
data: [
{
name: 'dataprovider.com',
ext: { segtax: 5 },
segment: [{ id: '6' }],
},
{
name: 'dataprovider.com',
ext: { segtax: 5 },
segment: [{ id: '17' }, { id: '20' }],
},
],
},
},
},
Expand Down Expand Up @@ -206,7 +228,7 @@ describe('dailymotionBidAdapterTests', () => {
description: bidRequestData[0].mediaTypes.video.description,
// No iabcat1 here because nothing matches taxonomy
iabcat1: [],
iabcat2: bidderRequestData.ortb2.site.content.cat,
iabcat2: ['6', '17', '20'],
id: bidRequestData[0].params.video.id,
lang: bidRequestData[0].params.video.lang,
private: bidRequestData[0].params.video.private,
Expand Down

0 comments on commit b399158

Please sign in to comment.