Skip to content

Commit

Permalink
oneVideo Adapter Support for Global & Bidder Specific Supply Chain Ob…
Browse files Browse the repository at this point in the history
…ject Module (SAPR-13809) (#5465)

* bidData Debug true if .source exists

* capture and pass config.schain

* changing from config.schain to bid.schain

* updated schain unit tests

* updated schain unit tests

* added schain examples to .md file

* backup before merging master

* updated schain logic to use bidRequest.schain instead of global schain only

* updated schain test to new bidRequest.schain logic

* Update package-lock.json

* Delete package-lock.json

* restoring package.lock

* restored package-lock.json
  • Loading branch information
adam-browning authored Jul 10, 2020
1 parent 656b352 commit a2ec9c2
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 16 deletions.
8 changes: 8 additions & 0 deletions modules/oneVideoBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as utils from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';

const BIDDER_CODE = 'oneVideo';
export const spec = {
code: 'oneVideo',
Expand Down Expand Up @@ -258,6 +259,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 (bid.schain) {
bidData.source = {
ext: {
schain: bid.schain
}
}
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'
}
}
]
}
]
```
66 changes: 58 additions & 8 deletions test/spec/modules/oneVideoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,63 @@ describe('OneVideoBidAdapter', function () {
expect(data.imp[0].video.w).to.equal(width);
expect(data.imp[0].video.h).to.equal(height);
});

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 send Global or Bidder specific schain if sid is not passed in video.params.sid', function () {
bidRequest.params.video.sid = null;
const globalSchain = {
ver: '1.0',
complete: 1,
nodes: [{
asi: 'some-platform.com',
sid: '111111',
rid: bidRequest.id,
hp: 1
}]
};
bidRequest.schain = globalSchain;
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(globalSchain);
});

it('should ignore Global or Bidder specific schain if video.params.sid exists and send new schain', function () {
const globalSchain = {
ver: '1.0',
complete: 1,
nodes: [{
asi: 'some-platform.com',
sid: '111111',
rid: bidRequest.id,
hp: 1
}]
};
bidRequest.schain = globalSchain;
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 +417,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

0 comments on commit a2ec9c2

Please sign in to comment.