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

oneVideo Adapter Support for Global & Bidder Specific Supply Chain Object Module (SAPR-13809) #5465

Merged
merged 18 commits into from
Jul 10, 2020
Merged
10 changes: 10 additions & 0 deletions modules/oneVideoBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as utils from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import { config } from '../src/config.js';

const BIDDER_CODE = 'oneVideo';
export const spec = {
code: 'oneVideo',
Expand Down Expand Up @@ -158,6 +160,7 @@ function isConsentRequired(consentData) {
}

function getRequestData(bid, consentData, bidRequest) {
let pbjsConfig = config.getConfig();
let loc = bidRequest.refererInfo.referer;
let page = (bid.params.site && bid.params.site.page) ? (bid.params.site.page) : (loc.href);
let ref = (bid.params.site && bid.params.site.referrer) ? bid.params.site.referrer : bidRequest.refererInfo.referer;
Expand Down Expand Up @@ -258,6 +261,13 @@ function getRequestData(bid, consentData, bidRequest) {
if (bid.params.video.hp == 1) {
bidData.source.ext.schain.nodes[0].hp = bid.params.video.hp;
}
} else if (pbjsConfig.schain) {
bidData.source = {
ext: {
schain: pbjsConfig.schain.config
}
}
bidData.source.ext.schain.nodes[0].rid = bidData.id;
}
if (bid.params.site && bid.params.site.id) {
bidData.site.id = bid.params.site.id
Expand Down
110 changes: 102 additions & 8 deletions modules/oneVideoBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
**Maintainer**: deepthi.neeladri.sravana@verizonmedia.com

# Description

Connects to Verizon Media's Video SSP (AKA ONE Video / Adap.tv) demand source to fetch bids.


# Instream Video adUnit example & parameters
# Integration Examples:
## Instream Video adUnit example & parameters
*Note:* The Video SSP ad server will respond with an VAST XML to load into your defined player.
```
var adUnits = [
Expand All @@ -34,7 +33,7 @@ Connects to Verizon Media's Video SSP (AKA ONE Video / Adap.tv) demand source to
position: 1,
delivery: [2],
playbackmethod: [1,5],
sid: <scpid>,
sid: YOUR_VSSP_ORG_ID,
hp: 1,
rewarded: 1,
placement: 1,
Expand All @@ -54,7 +53,7 @@ Connects to Verizon Media's Video SSP (AKA ONE Video / Adap.tv) demand source to
}
]
```
# Outstream Video adUnit example & parameters
## Outstream Video adUnit example & parameters
*Note:* The Video SSP ad server will load it's own Outstream Renderer (player) as a fallback if no player is defined on the publisher page. The Outstream player will inject into the div id that has an identical adUnit code.
```
var adUnits = [
Expand All @@ -79,7 +78,7 @@ Connects to Verizon Media's Video SSP (AKA ONE Video / Adap.tv) demand source to
position: 1,
delivery: [2],
playbackmethod: [1,5],
sid: <scpid>,
sid: YOUR_VSSP_ORG_ID,
hp: 1,
rewarded: 1,
placement: 1,
Expand All @@ -100,7 +99,7 @@ Connects to Verizon Media's Video SSP (AKA ONE Video / Adap.tv) demand source to
]
```

# S2S / Video: Dynamic Ad Placement (DAP) adUnit example & parameters
## S2S / Video: Dynamic Ad Placement (DAP) adUnit example & parameters
*Note:* The Video SSP ad server will respond with HTML embed tag to be injected into an iFrame you create.
```
var adUnits = [
Expand Down Expand Up @@ -135,7 +134,7 @@ Connects to Verizon Media's Video SSP (AKA ONE Video / Adap.tv) demand source to
}
]
```
# Prebid.js / Banner: Dynamic Ad Placement (DAP) adUnit example & parameters
## Prebid.js / Banner: Dynamic Ad Placement (DAP) adUnit example & parameters
*Note:* The Video SSP ad server will respond with HTML embed tag to be injected into an iFrame created by Google Ad Manager (GAM).
```
var adUnits = [
Expand Down Expand Up @@ -168,3 +167,98 @@ Connects to Verizon Media's Video SSP (AKA ONE Video / Adap.tv) demand source to
}
]
```

# Supply Chain Object Support
The oneVideoBidAdapter supports 2 methods for passing/creating an schain object.
1. By passing your Video SSP Org ID in the bid.video.params.sid - The adapter will create a new schain object and our ad-server will fill in the data for you.
2. Using the Prebid Supply Chain Object Module - The adapter will capture the schain object
*Note:* You cannot pass both schain object and bid.video.params.sid together. Option 1 will always be the default.

## Create new schain using bid.video.params.sid
sid = your Video SSP Organization ID.
This is for direct publishers only.
```
var adUnits = [
{
code: 'video1',
mediaTypes: {
video: {
context: 'instream',
playerSize: [480, 640]
}
},
bids: [
{
bidder: 'oneVideo',
params: {
video: {
playerWidth: 480,
playerHeight: 640,
mimes: ['video/mp4', 'application/javascript'],
protocols: [2,5],
api: [2],
sid:
},
site: {
id: 1,
page: 'https://verizonmedia.com',
referrer: 'https://verizonmedia.com'
},
pubId: 'HBExchange'
}
}
]
}
]
```

## Pass global schain using pbjs.setConfig(SCHAIN_OBJECT)
For both Authorized resellers and direct publishers.
```
pbjs.setConfig({
"schain": {
"validation": "strict",
"config": {
"ver": "1.0",
"complete": 1,
"nodes": [{
"asi": "some-platform.com",
"sid": "111111",
"hp": 1
}]
}
}
});

var adUnits = [
{
code: 'video1',
mediaTypes: {
video: {
context: 'instream',
playerSize: [480, 640]
}
},
bids: [
{
bidder: 'oneVideo',
params: {
video: {
playerWidth: 480,
playerHeight: 640,
mimes: ['video/mp4', 'application/javascript'],
protocols: [2,5],
api: [2],
},
site: {
id: 1,
page: 'https://verizonmedia.com',
referrer: 'https://verizonmedia.com'
},
pubId: 'HBExchange'
}
}
]
}
]
```
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 70 additions & 8 deletions test/spec/modules/oneVideoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,75 @@ describe('OneVideoBidAdapter', function () {
expect(data.imp[0].video.w).to.equal(width);
expect(data.imp[0].video.h).to.equal(height);
});

it('should send getConfig.schain if sid is not passed in video.params.sid', function () {
bidRequest.params.video.sid = null;
config.setConfig(
{
'schain': {
'validation': 'strict',
'config': {
'ver': '1.0',
'complete': 1,
'nodes': [{
'asi': 'some-platform.com',
'sid': '111111',
'hp': 1
}]
}
}
});
let pbjsConfigSchain = config.getConfig();
pbjsConfigSchain = pbjsConfigSchain.schain;
const requests = spec.buildRequests([ bidRequest ], bidderRequest);
const data = requests[0].data;
const schain = data.source.ext.schain;
expect(schain.nodes.length).to.equal(1);
expect(schain).to.equal(pbjsConfigSchain.config);
});

it('it should create new schain and send it if video.params.sid exists', function () {
const requests = spec.buildRequests([ bidRequest ], bidderRequest);
const data = requests[0].data;
const schain = data.source.ext.schain;
expect(schain.nodes.length).to.equal(1);
expect(schain.nodes[0].sid).to.equal(bidRequest.params.video.sid);
expect(schain.nodes[0].rid).to.equal(data.id);
})

it('should ignore getConfig.schain if video.params.sid exists and send new schain', function () {
config.setConfig(
{
'schain': {
'validation': 'strict',
'config': {
'ver': '1.0',
'complete': 1,
'nodes': [{
'asi': 'some-platform.com',
'sid': '111111',
'hp': 1
}]
}
}
});
let pbjsConfigSchain = config.getConfig();
pbjsConfigSchain = pbjsConfigSchain.schain;
const requests = spec.buildRequests([ bidRequest ], bidderRequest);
const data = requests[0].data;
const schain = data.source.ext.schain;
expect(schain.nodes.length).to.equal(1);
expect(schain.complete).to.equal(1);
expect(schain.nodes[0].sid).to.equal(bidRequest.params.video.sid);
expect(schain.nodes[0].rid).to.equal(data.id);
})

it('should append hp to new schain created by sid if video.params.hp is passed', function () {
const requests = spec.buildRequests([ bidRequest ], bidderRequest);
const data = requests[0].data;
const schain = data.source.ext.schain;
expect(schain.nodes[0].hp).to.equal(bidRequest.params.video.hp);
})
});

describe('spec.interpretResponse', function () {
Expand Down Expand Up @@ -360,15 +429,8 @@ describe('OneVideoBidAdapter', function () {
expect(request[0].data.regs.ext.gdpr).to.equal(1);
expect(request[0].data.regs.ext.us_privacy).to.equal(bidderRequest.uspConsent);
});

it('should send schain object', function () {
const requests = spec.buildRequests([ bidRequest ], bidderRequest);
const data = requests[0].data;
expect(data.source.ext.schain.nodes[0].sid).to.equal(bidRequest.params.video.sid);
expect(data.source.ext.schain.nodes[0].rid).to.equal(data.id);
expect(data.source.ext.schain.nodes[0].hp).to.equal(bidRequest.params.video.hp);
});
});

describe('should send banner object', function () {
it('should send banner object when display is 1 and context="instream" (DAP O&O)', function () {
bidRequest = {
Expand Down