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: add player name #12068

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
2 changes: 1 addition & 1 deletion modules/dailymotionBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ function getVideoMetadata(bidRequest, bidderRequest) {
title: videoParams.title || deepAccess(contentObj, 'title', ''),
url: videoParams.url || deepAccess(contentObj, 'url', ''),
topics: videoParams.topics || '',
xid: videoParams.xid || '',
isCreatedForKids: typeof videoParams.isCreatedForKids === 'boolean'
? videoParams.isCreatedForKids
: null,
Expand All @@ -79,6 +78,7 @@ function getVideoMetadata(bidRequest, bidderRequest) {
autoplay: typeof videoParams.autoplay === 'boolean'
? videoParams.autoplay
: null,
playerName: videoParams.playerName || deepAccess(contentObj, 'playerName', ''),
playerVolume: (
typeof videoParams.playerVolume === 'number' &&
videoParams.playerVolume >= 0 &&
Expand Down
18 changes: 11 additions & 7 deletions modules/dailymotionBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Please note that failing to set these will result in the adapter not bidding at
To allow better targeting, you should provide as much context about the video as possible.
There are three ways of doing this depending on if you're using Dailymotion player or a third party one.

If you are using the Dailymotion player, you should only provide the video `xid` in your ad unit, example:
If you are using the Dailymotion player, you must provide the video `xid` in the `video.id` field of your ad unit, example:

```javascript
const adUnits = [
Expand All @@ -98,7 +98,10 @@ const adUnits = [
params: {
apiKey: 'dailymotion-testing',
video: {
xid: 'x123456' // Dailymotion infrastructure unique video ID
id: 'x123456' // Dailymotion infrastructure unique video ID
autoplay: false,
playerName: 'dailymotion',
playerVolume: 8
},
}
}],
Expand All @@ -117,9 +120,9 @@ const adUnits = [
```

This will automatically fetch the most up-to-date information about the video.
If you provide any other metadata in addition to the `xid`, they will be ignored.
Please note that if you provide any video metadata not listed above, they will be replaced by the ones fetched from the `video.id`.

If you are using a third party video player, you should not provide any `xid` and instead fill the following members:
If you are using a third party video player, you should fill the following members:

```javascript
const adUnits = [
Expand All @@ -143,6 +146,7 @@ const adUnits = [
isCreatedForKids: false,
videoViewsInSession: 1,
autoplay: false,
playerName: 'video.js',
playerVolume: 8
}
}
Expand Down Expand Up @@ -181,14 +185,14 @@ Each of the following video metadata fields can be added in bids.params.video.
* `title` - Video title
* `url` - URL of the content
* `topics` - Main topics for the video, comma separated
* `xid` - Dailymotion video identifier (only applicable if using the Dailymotion player)
* `isCreatedForKids` - [The content is created for children as primary audience](https://faq.dailymotion.com/hc/en-us/articles/360020920159-Content-created-for-kids)

The following contextual informations can also be added in bids.params.video.
The following contextual information can also be added in bids.params.video.

* `videoViewsInSession` - Number of videos viewed within the current user session
* `autoplay` - Playback was launched without user interaction
* `playerName` - Name of the player used to display the video
* `playerVolume` - Player volume between 0 (muted, 0%) and 10 (100%)
* `videoViewsInSession` - Number of videos viewed within the current user session

If you already specify [First-Party data](https://docs.prebid.org/features/firstPartyData.html) through the `ortb2` object when calling [`pbjs.requestBids(requestObj)`](https://docs.prebid.org/dev-docs/publisher-api-reference/requestBids.html), we will collect the following values and fallback to bids.params.video values when applicable. See the mapping below.

Expand Down
24 changes: 12 additions & 12 deletions test/spec/modules/dailymotionBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ describe('dailymotionBidAdapterTests', () => {
title: 'test video',
url: 'https://test.com/test',
topics: 'topic_1, topic_2',
xid: 'x123456',
livestream: 1,
isCreatedForKids: true,
videoViewsInSession: 2,
autoplay: true,
playerName: 'dailymotion',
playerVolume: 8,
},
},
Expand Down Expand Up @@ -204,14 +204,14 @@ describe('dailymotionBidAdapterTests', () => {
title: bidRequestData[0].params.video.title,
url: bidRequestData[0].params.video.url,
topics: bidRequestData[0].params.video.topics,
xid: bidRequestData[0].params.video.xid,
duration: bidRequestData[0].params.video.duration,
livestream: !!bidRequestData[0].params.video.livestream,
isCreatedForKids: bidRequestData[0].params.video.isCreatedForKids,
context: {
siteOrAppCat: [],
videoViewsInSession: bidRequestData[0].params.video.videoViewsInSession,
autoplay: bidRequestData[0].params.video.autoplay,
playerName: bidRequestData[0].params.video.playerName,
playerVolume: bidRequestData[0].params.video.playerVolume,
},
});
Expand Down Expand Up @@ -254,11 +254,11 @@ describe('dailymotionBidAdapterTests', () => {
title: 'test video',
url: 'https://test.com/test',
topics: 'topic_1, topic_2',
xid: 'x123456',
livestream: 1,
isCreatedForKids: true,
videoViewsInSession: 2,
autoplay: true,
playerName: 'dailymotion',
playerVolume: 8,
},
},
Expand Down Expand Up @@ -344,11 +344,11 @@ describe('dailymotionBidAdapterTests', () => {
title: 'test video',
url: 'https://test.com/test',
topics: 'topic_1, topic_2',
xid: 'x123456',
livestream: 1,
isCreatedForKids: true,
videoViewsInSession: 2,
autoplay: true,
playerName: 'dailymotion',
playerVolume: 8,
},
},
Expand Down Expand Up @@ -431,11 +431,11 @@ describe('dailymotionBidAdapterTests', () => {
title: 'test video',
url: 'https://test.com/test',
topics: 'topic_1, topic_2',
xid: 'x123456',
livestream: 1,
isCreatedForKids: true,
videoViewsInSession: 2,
autoplay: true,
playerName: 'dailymotion',
playerVolume: 8,
},
},
Expand Down Expand Up @@ -537,11 +537,11 @@ describe('dailymotionBidAdapterTests', () => {
title: 'test video',
url: 'https://test.com/test',
topics: 'topic_1, topic_2',
xid: 'x123456',
livestream: 1,
isCreatedForKids: true,
videoViewsInSession: 2,
autoplay: true,
playerName: 'dailymotion',
playerVolume: 8,
},
},
Expand Down Expand Up @@ -645,11 +645,11 @@ describe('dailymotionBidAdapterTests', () => {
title: 'test video',
url: 'https://test.com/test',
topics: 'topic_1, topic_2',
xid: 'x123456',
livestream: 1,
isCreatedForKids: true,
videoViewsInSession: 2,
autoplay: true,
playerName: 'dailymotion',
playerVolume: 8,
},
},
Expand Down Expand Up @@ -745,12 +745,12 @@ describe('dailymotionBidAdapterTests', () => {
title: 'test video',
url: 'https://test.com/test',
topics: 'topic_1, topic_2',
xid: 'x123456',
livestream: 1,
// Test invalid values
isCreatedForKids: 'false',
videoViewsInSession: -1,
autoplay: 'true',
playerName: 'dailymotion',
playerVolume: 12,
},
},
Expand Down Expand Up @@ -855,7 +855,6 @@ describe('dailymotionBidAdapterTests', () => {
title: bidRequestData[0].params.video.title,
url: bidRequestData[0].params.video.url,
topics: bidRequestData[0].params.video.topics,
xid: bidRequestData[0].params.video.xid,
// Overriden through bidder params
duration: bidderRequestData.ortb2.app.content.len,
livestream: !!bidRequestData[0].params.video.livestream,
Expand All @@ -864,6 +863,7 @@ describe('dailymotionBidAdapterTests', () => {
siteOrAppCat: [],
videoViewsInSession: null,
autoplay: null,
playerName: 'dailymotion',
playerVolume: null,
},
});
Expand All @@ -889,10 +889,10 @@ describe('dailymotionBidAdapterTests', () => {
private: false,
title: 'test video',
topics: 'topic_1, topic_2',
xid: 'x123456',
isCreatedForKids: false,
videoViewsInSession: 10,
autoplay: false,
playerName: 'dailymotion',
playerVolume: 0,
},
},
Expand Down Expand Up @@ -1035,14 +1035,14 @@ describe('dailymotionBidAdapterTests', () => {
title: bidderRequestData.ortb2.site.content.title,
url: bidderRequestData.ortb2.site.content.url,
topics: bidRequestData[0].params.video.topics,
xid: bidRequestData[0].params.video.xid,
duration: bidRequestData[0].params.video.duration,
livestream: !!bidderRequestData.ortb2.site.content.livestream,
isCreatedForKids: bidRequestData[0].params.video.isCreatedForKids,
context: {
siteOrAppCat: bidderRequestData.ortb2.site.content.cat,
videoViewsInSession: bidRequestData[0].params.video.videoViewsInSession,
autoplay: bidRequestData[0].params.video.autoplay,
playerName: bidRequestData[0].params.video.playerName,
playerVolume: bidRequestData[0].params.video.playerVolume,
},
});
Expand Down Expand Up @@ -1127,13 +1127,13 @@ describe('dailymotionBidAdapterTests', () => {
title: '',
url: '',
topics: '',
xid: '',
livestream: false,
isCreatedForKids: null,
context: {
siteOrAppCat: [],
videoViewsInSession: null,
autoplay: null,
playerName: '',
playerVolume: null,
},
});
Expand Down