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: Move API key to bid params #12

Merged
merged 2 commits into from
Apr 3, 2024
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
13 changes: 7 additions & 6 deletions modules/dailymotionBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,13 @@ export const spec = {

/**
* Determines whether or not the given bid request is valid.
* The only mandatory parameters for a bid to be valid are the api_key and position configuration entries.
* The only mandatory parameter for a bid to be valid is the API key.
* Other parameters are optional.
*
* @return boolean True if this is a valid bid, and false otherwise.
*/
isBidRequestValid: () => {
const dmConfig = config.getConfig('dailymotion');
return !!dmConfig?.api_key;
isBidRequestValid: function (bid) {
return (typeof bid.params.apiKey === 'string');
},

/**
Expand All @@ -74,9 +73,12 @@ export const spec = {
},
uspConsent: bidderRequest?.uspConsent || '',
},
config: config.getConfig('dailymotion'),
config: {
api_key = bid.params.apiKey
},
coppa: config.getConfig('coppa'),
request: {
adUnitCode: bid.adUnitCode || '',
auctionId: bid.auctionId || '',
bidId: bid.bidId || '',
mediaTypes: {
Expand All @@ -87,7 +89,6 @@ export const spec = {
},
},
sizes: bid.sizes || [],
adUnitCode: bid.adUnitCode || '',
},
video_metadata: getVideoMetadata(bid),
},
Expand Down
86 changes: 48 additions & 38 deletions modules/dailymotionBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,41 @@ Dailymotion prebid adapter.

# Configuration options

Before calling this adapter, you need to set its configuration with a call like this:
Before calling this adapter, you need to set at least the API key in the bid parameters:

```javascript
pbjs.setBidderConfig({
bidders: ["dailymotion"],
config: {
dailymotion: {
api_key: 'fake_api_key',
}
}
});
const adUnits = [
{
bids: [{
bidder: 'dailymotion',
params: {
apiKey: 'fake_api_key'
}
}]
}
];
```

This call must be made before the first auction to allow proper authentication with our servers.

`api_key` is your publisher API key. For testing purpose, you can use "dailymotion-testing".
`apiKey` is your publisher API key. For testing purpose, you can use "dailymotion-testing".

# Test Parameters

By setting the following configuration options, you'll get a constant response to any request to validate your adapter integration:
By setting the following bid parameters, you'll get a constant response to any request, to validate your adapter integration:

```javascript
pbjs.setBidderConfig({
bidders: ["dailymotion"],
config: {
dailymotion: {
api_key: 'dailymotion-testing'
}
}
});
const adUnits = [
{
bids: [{
bidder: 'dailymotion',
params: {
apiKey: 'dailymotion-testing'
}
}]
}
];
```

Please note that failing to set these configuration options will result in the adapter not bidding at all.
Please note that failing to set these will result in the adapter not bidding at all.

# Sample video AdUnit

Expand All @@ -56,13 +58,20 @@ If you are using the Dailymotion player, you should only provide the video `xid`
```javascript
const adUnits = [
{
bids: [{
bidder: 'dailymotion',
params: {
apiKey: 'dailymotion-testing'
}
}],
code: 'test-ad-unit',
mediaTypes: {
video: {
api: [2, 7],
context: 'instream',
playerSize: [1280, 720],
api: [2,7],
xid: 'x123456'
playerSize: [ [1280, 720] ],
startDelay: 0,
xid: 'x123456' // Dailymotion infrastructure unique video ID
},
}
}
Expand All @@ -77,32 +86,33 @@ If you are using a third party video player, you should not provide any `xid` an
```javascript
const adUnits = [
{
bids: [{
bidder: 'dailymotion',
params: {
apiKey: 'dailymotion-testing',
video: {
description: 'overriden video description'
}
}
}],
code: 'test-ad-unit',
mediaTypes: {
video: {
api: [2, 7],
context: 'instream',
playerSize: [1280, 720],
api: [2,7],
description: 'this is a video description',
duration: 556,
iabcat2: ['6', '17'],
id: '54321',
lang: 'FR',
playerSize: [ [1280, 720] ],
private: false,
startDelay: 0,
tags: 'tag_1,tag_2,tag_3',
title: 'test video',
topics: 'topic_1, topic_2',
},
},
bids: [{
bidder: "dailymotion",
params: {
video: {
description: 'overriden video description',
duration: 330
}
}
}]
}
}
];
```
Expand All @@ -125,6 +135,6 @@ If a field exists in both places, it will be overridden by bids.params.video.

To use the adapter with any non-test request, you first need to ask an API key from Dailymotion. Please contact us through **DailymotionPrebid.js@dailymotion.com**.

You will then be able to use it within the `config` before making a bid request.
You will then be able to use it within the bid parameters before making a bid request.

This API key will ensure proper identification of your inventory and allow you to get real bids.