### Running the Example Setup
Source: https://github.com/prebid/prebid.js/blob/master/modules/responsiveAdsBidAdapter.md
Execute this command in your terminal to run the example setup and view the on-page configuration. This command is used for local development and testing.
```bash
gulp serve-and-test --file test/spec/modules/responsiveAdsBidAdapter_spec.js
```
--------------------------------
### Start Review Server and Tools
Source: https://github.com/prebid/prebid.js/blob/master/PR_REVIEW.md
Runs the development server, code coverage reports, and integration examples. Use `--host=0.0.0.0` to bind to all IPs.
```bash
gulp review-start
gulp review-start --host=0.0.0.0
```
--------------------------------
### Start Local Development Server
Source: https://github.com/prebid/prebid.js/blob/master/modules/neuwoRtdProvider.md
Runs a local development server with the Neuwo module and a test bid adapter. Access the example page at http://localhost:9999/integrationExamples/gpt/neuwoRtdProvider_example.html.
```bash
npx gulp serve --modules=rtdModule,neuwoRtdProvider,appnexusBidAdapter
```
--------------------------------
### Setup with Multiple Providers using Aliases
Source: https://github.com/prebid/prebid.js/blob/master/modules/relevantdigitalBidAdapter.md
Example demonstrating how to set up multiple providers by aliasing the 'relevantdigital' bidder. This allows distinct configurations for each provider, managed through `pbjs.aliasBidder` and `pbjs.setConfig`.
```javascript
pbjs.aliasBidder('relevantdigital', 'providerA');
pbjs.aliasBidder('relevantdigital', 'providerB');
pbjs.setConfig({
providerA: {
pbsHost: 'pbs-example-a.relevant-digital.com',
accountId: '620533ae7f5bbe1691bbb815',
},
providerB: {
pbsHost: 'pbs-example-b.relevant-digital.com',
accountId: '990533ae7f5bbe1691bbb815',
},
});
var adUnits = [
{
code: 'test-div',
mediaTypes: { banner: { sizes: [[300, 250], [320, 320]] }},
bids: [
{
bidder: 'providerA',
params: {
placementId: '610525862d7517bfd4bbb81e_620523b7d1dbed6b0fbbb817',
}
},
{
bidder: 'providerB',
params: {
placementId: '990525862d7517bfd4bbb81e_770523b7d1dbed6b0fbbb817',
}
},
],
}
];
```
--------------------------------
### In-Image Ad Unit Integration Example
Source: https://github.com/prebid/prebid.js/blob/master/modules/voxBidAdapter.md
Example HTML page demonstrating the integration of an In-Image ad unit with Prebid.js and the VOX adapter. Includes ad unit setup, bid request, and rendering logic.
```html
Prebid.js Banner Example
Prebid.js InImage Banner Test
```
--------------------------------
### Start Manual Testing with Gulp
Source: https://github.com/prebid/prebid.js/blob/master/AGENTS.md
Initiate manual testing and open coverage reports and integration examples. This command is useful for interactive testing.
```bash
gulp review-start
```
--------------------------------
### Serve Prebid with AirGrid Example
Source: https://github.com/prebid/prebid.js/blob/master/modules/airgridRtdProvider.md
Serve Prebid.js with the AirGrid RTD module and an adapter for local testing. Access the example HTML file in your browser.
```bash
gulp serve-fast --modules=rtdModule,airgridRtdProvider,appnexusBidAdapter
```
--------------------------------
### Configure Define Media Bid Adapter
Source: https://github.com/prebid/prebid.js/blob/master/modules/defineMediaBidAdapter.md
Example of how to configure the Define Media adapter within a Prebid.js setup. Ensure publishers are onboarded by Define Media before use.
```javascript
pbjs.addAdUnits([
{
code: 'div-gpt-ad-123',
mediaTypes: { banner: { sizes: [[300, 250]] } },
bids: [{
bidder: 'defineMedia',
params: {
supplierDomainName: 'definemedia.de',
// set only for non-billable tests
devMode: false
}
}]
}
]);
```
--------------------------------
### Bitmedia Adapter Configuration Example
Source: https://github.com/prebid/prebid.js/blob/master/modules/bitmediaBidAdapter.md
Example of how to configure the Bitmedia adapter within your ad units. Ensure you replace 'exampleAdUnitID' with your actual publisher ID.
```javascript
var adUnits = [
{
code: 'banner-div',
mediaTypes: {
banner: {
sizes: [[300, 250], [300, 600]],
},
},
bids: [{
bidder: 'bitmedia',
params: {
adUnitID: 'exampleAdUnitID',
currency: 'USD',
},
}],
},
];
```
--------------------------------
### Run Reconciliation Example
Source: https://github.com/prebid/prebid.js/blob/master/modules/reconciliationRtdProvider.md
Serve the Prebid build with the Reconciliation RTD Provider and an adapter for local testing. Navigate to the provided URL in your browser to view the example.
```bash
gulp serve --modules=reconciliationRtdProvider,appnexusBidAdapter
```
--------------------------------
### Serve Azerion Edge RTD Example
Source: https://github.com/prebid/prebid.js/blob/master/modules/azerionedgeRtdProvider.md
Serve the Azerion Edge RTD example using Gulp for testing purposes. Access the example via the provided localhost URL.
```bash
gulp serve-fast --modules=rtdModule,azerionedgeRtdProvider
```
--------------------------------
### Serve with Geoedge Example
Source: https://github.com/prebid/prebid.js/blob/master/modules/geoedgeRtdProvider.md
Run a local development server with the geoedge RTD provider and appnexus bid adapter enabled for testing integration examples.
```bash
gulp serve --modules=appnexusBidAdapter,geoedgeRtdProvider
```
--------------------------------
### Full HTML Example with In-Image Ad
Source: https://github.com/prebid/prebid.js/blob/master/modules/hybridBidAdapter.md
Demonstrates a complete HTML page setup for displaying an in-image ad using Prebid.js and the Hybrid.ai adapter. Includes Prebid.js initialization, ad unit definition, bid request, and ad rendering logic.
```html
Prebid.js Banner Example
Prebid.js InImage Banner Test
```
--------------------------------
### Prebid.js Setup and BidViewabilityIO Configuration
Source: https://github.com/prebid/prebid.js/blob/master/integrationExamples/postbid/bidViewabilityIO_example.html
Initializes Prebid.js and enables the BidViewabilityIO module. This setup is required before defining ad units or requesting bids.
```javascript
var pbjs = pbjs || {}; pbjs.que = pbjs.que || [];
(function() {
var pbjsEl = document.createElement("script");
pbjsEl.type = "text/javascript";
pbjsEl.async = true;
pbjsEl.src = '../../build/dev/prebid.js';
var pbjsTargetEl = document.getElementsByTagName("head")[0];
pbjsTargetEl.insertBefore(pbjsEl, pbjsTargetEl.firstChild);
})();
pbjs.que.push(function() {
var adUnits = [
{
code: 'regular_iframe',
mediaTypes: {
banner: {
sizes: [[300, 250]]
}
},
bids: [
{
bidder: 'appnexus',
params: {
placementId: 13144370
}
}
]
},
{
code: 'large_iframe',
mediaTypes: {
banner: {
sizes: [[970, 250]]
}
},
bids: [
{
bidder: 'appnexus',
params: {
placementId: 13144370
}
}
]
},
];
pbjs.setConfig({
bidderTimeout: 1000,
bidViewabilityIO: {
enabled: true,
}
});
pbjs.onEvent('adRenderSucceeded', ({bid}) => {
var p = document.createElement('p');
p.innerHTML = bid.adUnitCode + ' was rendered';
document.getElementById('notes').appendChild(p);
});
pbjs.onEvent('bidViewable', (bid) => {
var p = document.createElement('p');
p.innerHTML = bid.adUnitCode + ' was viewed';
document.getElementById('notes').appendChild(p);
});
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: function(bidResponses) {
Object.keys(bidResponses).forEach(adUnitCode => {
var highestCpmBids = pbjs.getHighestCpmBids(adUnitCode);
var winner = highestCpmBids.pop();
var iframe = document.getElementById(adUnitCode);
var iframeDoc = iframe.contentWindow.document;
if (winner && winner.mediaType === 'banner') {
pbjs.renderAd(iframeDoc, winner.adId);
} else if (winner) {
iframe.width = 300;
iframe.height = 300;
iframeDoc.write('unsupported mediaType');
iframeDoc.close();
} else {
iframe.width = 300;
iframe.height = 300;
iframeDoc.write('no winner');
iframeDoc.close();
}
});
}
})
});
```
--------------------------------
### Access Weborama RTD Example
Source: https://github.com/prebid/prebid.js/blob/master/modules/weboramaRtdProvider.md
After serving the build, navigate to this URL in your browser to view the integration example and test the Weborama RTD Provider.
```html
http://localhost:9999/integrationExamples/gpt/weboramaRtdProvider_example.html
```
--------------------------------
### Access Geoedge Integration Example
Source: https://github.com/prebid/prebid.js/blob/master/modules/geoedgeRtdProvider.md
Navigate to the specified URL in your browser to view the Geoedge RTD provider integration example with GPT.
```bash
http://localhost:9999/integrationExamples/gpt/geoedgeRtdProvider_example.html
```
--------------------------------
### Panxo Bid Adapter Configuration Example
Source: https://github.com/prebid/prebid.js/blob/master/modules/panxoBidAdapter.md
Example of how to configure ad units for the Panxo bidder within Prebid.js. Ensure your 'propertyKey' is correctly set in the params.
```javascript
var adUnits = [{
code: 'banner-ad',
mediaTypes: {
banner: {
sizes: [[300, 250], [728, 90]]
}
},
bids: [{
bidder: 'panxo',
params: {
propertyKey: 'your-property-key-here'
}
}]
}];
```
--------------------------------
### Access Relevad RTD Provider Example Page
Source: https://github.com/prebid/prebid.js/blob/master/modules/relevadRtdProvider.md
Access this URL in your browser to view the on-page setup example for the Relevad RTD Provider.
```http
http://localhost:9999/integrationExamples/gpt/relevadRtdProvider_example.html
```
--------------------------------
### Discovery Bid Adapter Test Parameters
Source: https://github.com/prebid/prebid.js/blob/master/modules/discoveryBidAdapter.md
Example ad unit configurations for the discovery Bid Adapter, demonstrating setup for both native and banner ad types. Ensure you contact popIn for required setup before use.
```javascript
var adUnits = [
// native
{
code: "test-div-1",
mediaTypes: {
native: {
title: {
required: true
},
image: {
required: true
}
}
},
bids: [
{
bidder: "discovery",
params: {
token: "a1b067897e4ae093d1f94261e0ddc6c9",
tagid: 'test_tagid',
publisher: 'test_publisher'
},
},
],
},
// banner
{
code: "test-div-2",
mediaTypes: {
banner: {
sizes: [[300, 250]],
},
},
bids: [
{
bidder: "discovery",
params: {
token: "d0f4902b616cc5c38cbe0a08676d0ed9",
tagid: 'test_tagid',
publisher: 'test_publisher'
},
},
],
},
];
```
--------------------------------
### Start Demo App
Source: https://github.com/prebid/prebid.js/blob/master/modules/missenaBidAdapter.md
Run the demo application with the Missena adapter enabled.
```shell
gulp serve-fast --modules=missenaBidAdapter
```
--------------------------------
### Run 51Degrees RTD Provider Example
Source: https://github.com/prebid/prebid.js/blob/master/modules/51DegreesRtdProvider.md
Execute this command to build and serve the Prebid.js project with the 51Degrees RTD Provider and AppNexus Bid Adapter modules enabled. Open the specified URL in your browser to view the integration example and check the console for logs.
```bash
gulp serve --modules=rtdModule,51DegreesRtdProvider,appnexusBidAdapter
```
--------------------------------
### ConceptX Bidder Adapter Configuration
Source: https://github.com/prebid/prebid.js/blob/master/modules/conceptxBidAdapter.md
Example of how to configure an ad unit for the ConceptX bidder. Ensure the bidder name and parameters match your setup.
```javascript
var adUnits = [
{
code: "test-div",
mediaTypes: {
banner: {
sizes: [[980, 180]]
}
},
bids: [
{
bidder: "conceptx",
params: {
site: "example",
adunit: "some-id-3",
}
},
]
},
];
```
--------------------------------
### Criteo Bid Adapter Test Parameters
Source: https://github.com/prebid/prebid.js/blob/master/modules/criteoBidAdapter.md
Example configuration for ad units when using the Criteo bidder. Ensure the zoneId is correctly set for your setup.
```javascript
var adUnits = [
{
code: 'banner-ad-div',
sizes: [[300, 250], [728, 90]],
bids:
{
bidder: 'criteo',
params:
{
zoneId: 497747
}
}
}
];
```
--------------------------------
### Clickio Bidder Adapter Setup
Source: https://github.com/prebid/prebid.js/blob/master/modules/clickioBidAdapter.md
Example of how to configure the Clickio bidder adapter within your ad units. Replace 'test' with your assigned 'said' ID.
```javascript
var adUnits = [
{
code: 'clickio-banner-ad',
mediaTypes: {
banner: {
sizes: [
[300, 250]
]
}
},
bids: [
{
bidder: 'clickio',
params: {
said: 'test',
}
}
]
}
];
```
--------------------------------
### In-Stream Video Ad Unit Configuration
Source: https://github.com/prebid/prebid.js/blob/master/modules/smartxBidAdapter.md
Example configuration for an in-stream video ad unit. This setup is suitable for traditional in-stream video ad placements.
```javascript
var adUnits = [{
code: 'video1',
mediaTypes: {
video: {
context: 'instream',
playerSize: [640, 360]
}
},
bids: [{
bidder: 'smartx',
params: {
tagId: 'Nu68JuOWAvrbzoyrOR9a7A',
publisherId: '11986',
siteId: '22860',
bidfloor: 0.3,
bidfloorcur: 'EUR',
at: 2,
cur: ['EUR']
}
}],
}];
```
--------------------------------
### Build Prebid.js with Start.io Modules
Source: https://github.com/prebid/prebid.js/blob/master/modules/startioIdSystem.md
Include the necessary modules for the Start.io User ID submodule and bid adapter when building Prebid.js.
```bash
gulp build --modules=startioBidAdapter,userId,startioIdSystem,consentManagementTcf,consentManagementGpp,consentManagementUsp,...
```
--------------------------------
### Tapnative Bidder Adapter Configuration
Source: https://github.com/prebid/prebid.js/blob/master/modules/tapnativeBidAdapter.md
Example ad unit configurations for Tapnative, demonstrating setup for both banner and native ad types. Ensure placement_id is provided for each.
```javascript
var adUnits = [
{
code: 'display-ad',
mediaTypes: {
banner: {
sizes: [[300, 250]],
}
}
bids: [
{
bidder: 'tapnative',
params: {
placement_id: 111520, // Required parameter
width: 300, // Optional parameter
height: 250, // Optional parameter
bid_floor: 0.5 // Optional parameter
}
}
]
},
{
code: 'native-ad-container',
mediaTypes: {
native: {
title: { required: true, len: 100 },
image: { required: true, sizes: [300, 250] },
sponsored: { required: false },
clickUrl: { required: true },
desc: { required: true },
icon: { required: false, sizes: [50, 50] },
cta: { required: false }
}
},
bids: [
{
bidder: 'tapnative',
params: {
placement_id: 111519, // Required parameter
bid_floor: 1 // Optional parameter
}
}
]
}
];
```
--------------------------------
### Serve and Test 1plusX RTD Provider Example
Source: https://github.com/prebid/prebid.js/blob/master/modules/1plusXRtdProvider.md
Build and serve Prebid.js with the 1plusX RTD provider and specific adapters to test its functionality. Access the example HTML page via the specified local URL.
```bash
gulp serve --modules=rtdModule,1plusXRtdProvider,appnexusBidAdapter,rubiconBidAdapter
```
--------------------------------
### Mabidder Bid Adapter Test Parameters
Source: https://github.com/prebid/prebid.js/blob/master/modules/mabidderBidAdapter.md
Example configuration for an ad unit using the mabidder bidder. Ensure the 'ppid' parameter is set correctly for your setup.
```javascript
var adUnits = [
{
code: 'test_banner',
mediaTypes: {
banner: {
sizes: [300, 250]
}
},
bids: [{
bidder: 'mabidder',
params: {
ppid: 'test'
}
}],
}
];
```
--------------------------------
### Serve Prebid.js Project Locally
Source: https://github.com/prebid/prebid.js/blob/master/README.md
Builds the project, runs linters and tests, and starts a local web server. This is the primary command for local development and testing.
```bash
gulp serve
```
--------------------------------
### Iprom Prebid Adapter Test Parameters
Source: https://github.com/prebid/prebid.js/blob/master/modules/ipromBidAdapter.md
Example configuration for an ad unit using the Iprom bidder. Ensure the bidder name and parameters match your setup.
```javascript
var adUnits = [
{
code: 'test-div',
mediaTypes: {
banner: {
sizes: [[300, 250]], // a display size
}
},
bids: [
{
bidder: "iprom",
params: {
id: '1234',
dimension: '300x250'
}
}
]
}
];
```
--------------------------------
### Run Optable RTD Provider Example
Source: https://github.com/prebid/prebid.js/blob/master/modules/optableRtdProvider.md
Command to build and serve the Prebid.js project with the Optable RTD provider and related modules enabled. This is used to test the Optable RTD provider's functionality.
```bash
gulp serve --modules=optableRtdProvider,consentManagementGpp,consentManagementTcf,appnexusBidAdapter
```
--------------------------------
### Biddo Adapter Configuration
Source: https://github.com/prebid/prebid.js/blob/master/modules/biddoBidAdapter.md
Example of how to configure the Biddo bidder adapter within Prebid.js ad units. Ensure the zoneId parameter is correctly set for your setup.
```javascript
const adUnits = [{
code: 'test-div',
mediaTypes: {
banner: {
sizes: [[300, 250]],
},
},
bids: [{
bidder: 'biddo',
params: {
zoneId: 7254,
},
}],
}];
```
--------------------------------
### OpenX Ad Unit Configuration Example
Source: https://github.com/prebid/prebid.js/blob/master/modules/openxBidAdapter.md
Demonstrates how to configure ad units for the OpenX bidder, including banner, video, and native ad types. Shows usage of parameters like unit, delDomain, platform, customParams, and video specific settings.
```javascript
var adUnits = [
{
code: 'test-div',
sizes: [[728, 90]], // a display size
mediaTypes: {'banner': {}},
bids: [
{
bidder: 'openx',
params: {
unit: '539439964',
delDomain: 'se-demo-d.openx.net',
customParams: {
key1: 'v1',
key2: ['v2', 'v3']
},
}
}, {
bidder: 'openx',
params: {
unit: '539439964',
platform: 'a3aece0c-9e80-4316-8deb-faf804779bd1',
customParams: {
key1: 'v1',
key2: ['v2', 'v3']
},
}
}
]
},
{
code: 'video1',
mediaTypes: {
video: {
playerSize: [640, 480],
context: 'instream',
mimes: ['video/x-ms-wmv, video/mp4']
}
},
bids: [{
bidder: 'openx',
params: {
unit: '1611023124',
delDomain: 'PUBLISHER-d.openx.net',
video: {
mimes: ['video/x-ms-wmv, video/mp4'] // mediaTypes.video preferred
}
}
}]
},
{
code: 'native1',
mediaTypes: {
native: {
ortb: {
ver: '1.2',
assets: [
{
required: 1,
img: {
type: 1,
hmin: 50
},
}, {
required: 1,
title: {
len: 80
}
}
]
}
}
},
bids: [{
bidder: 'openx',
params: {
unit: '1611023124',
delDomain: 'PUBLISHER-d.openx.net',
customParams: {
key1: 'v1',
key2: ['v2', 'v3']
}
}
}]
}
];
```
--------------------------------
### Ad Unit Configuration for Adnuntius
Source: https://github.com/prebid/prebid.js/blob/master/modules/adnuntiusBidAdapter.md
Example configuration for an ad unit using the Adnuntius bidder. Ensure 'auId', 'network', and 'maxDeals' are correctly set for your setup.
```javascript
var adUnits = [
{
code: "test-div",
mediaTypes: {
banner: {
sizes: [[980, 360], [980, 300], [980, 240], [980, 120]]
}
},
bids: [
{
bidder: "adnuntius",
params: {
auId: "8b6bc",
network: "adnuntius",
maxDeals: 0
}
},
]
},
];
```
--------------------------------
### Build Prebid.js with Dailymotion Adapter
Source: https://github.com/prebid/prebid.js/blob/master/modules/dailymotionBidAdapter.md
Use this command to build Prebid.js including the Dailymotion adapter and the priceFloors module.
```shell
gulp build --modules=priceFloors,dailymotionBidAdapter
```
--------------------------------
### Legacy Request Format Example
Source: https://github.com/prebid/prebid.js/blob/master/modules/condorxBidAdapter.md
Illustrates a GET request to the legacy CondorX endpoint using query parameters. Ensure website and widget IDs are correctly formatted.
```http
GET https://api.condorx.io/cxb/get.json?w=789012&wg=123456&...
```
--------------------------------
### Install and Build AIDEM Bid Adapter
Source: https://github.com/prebid/prebid.js/blob/master/modules/aidemBidAdapter.md
Use these commands to install dependencies, build the AIDEM bid adapter, and serve it locally for development. Ensure you are using the correct Node.js version with nvm.
```shell
nvm use
npm install
gulp build --modules=aidemBidAdapter
gulp serve --modules=aidemBidAdapter
```
--------------------------------
### VideoJS Playlist Setup with Prebid.js
Source: https://github.com/prebid/prebid.js/blob/master/integrationExamples/videoModule/videojs/playlist.html
This snippet shows how to initialize VideoJS with a playlist and integrate Prebid.js for ad serving. It listens for 'videoSetupComplete' to load playlist items and 'videoSetupFailed' for error handling.
```javascript
var adUnits = [ { code: 'video_1', video: { context: 'instream', playerSize: [640, 360], adServerCID: '1001' } } ];
pbjs.addAdUnits(adUnits);
pbjs.onEvent('videoSetupComplete', e => {
const player = videojs('player');
// Load the playlist items with their metadata when the video player is done instantiating.
player.playlist([
{
sources: [
{
id: 'XYXYXYXY',
src: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
title: 'Subaru Outback On Street And Dirt',
description: 'Smoking Tire takes the all-new Subaru Outback to the highest point we can find in hopes our customer-appreciation Balloon Launch will get some free T-shirts into the hands of our viewers.',
type: 'video/mp4'
}
]
},
{
sources: [
{
id: 'ZAZAZAZA',
src : "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
title : "Big Buck Bunny",
description : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
type: 'video/mp4'
}
]
},
{
sources: [
{
id: 'WSWSWSWS',
src: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/Sintel.mp4",
title : "Sintel",
description: "Sintel is an independently produced short film, initiated by the Blender Foundation as a means to further improve and validate the free/open source 3D creation suite Blender. With initial funding provided by 1000s of donations via the internet community, it has again proven to be a viable development model for both open 3D technology as for independent animation film.\nThis 15 minute film has been realized in the studio of the Amsterdam Blender Institute, by an international team of artists and developers. In addition to that, several crucial technical and creative targets have been realized online, by developers and artists and teams all over the world.\nwww.sintel.org",
type: 'video/mp4'
}
]
}
]);
player.playlist.autoadvance(0);
});
pbjs.onEvent('videoSetupFailed', e => {
console.log('player setup failed: ', e);
});
pbjs.onEvent('videoPlaylist', (e) => {
console.log('videos pb playlist: ', e);
});
pbjs.onEvent('videoContentLoaded', (e) => {
console.log('videos pb contentLoaded: ', e);
});
pbjs.requestBids();
```
--------------------------------
### eHealthcareSolutions Ad Unit Configuration
Source: https://github.com/prebid/prebid.js/blob/master/modules/ehealthcaresolutionsBidAdapter.md
Example ad unit configurations for eHealthcareSolutions, demonstrating setup for both BANNER and NATIVE ad types. Ensure required parameters like placement_id are provided.
```javascript
var adUnits = [
{
code: 'display-ad',
mediaTypes: {
banner: {
sizes: [[300, 250]],
}
}
bids: [
{
bidder: 'ehealthcaresolutions',
params: {
placement_id: 111519, // Required parameter
width: 300, // Optional parameter
height: 250, // Optional parameter
bid_floor: 0.5 // Optional parameter
}
}
]
},
{
code: 'native-ad-container',
mediaTypes: {
native: {
title: { required: true, len: 100 },
image: { required: true, sizes: [300, 250] },
sponsored: { required: false },
clickUrl: { required: true },
desc: { required: true },
icon: { required: false, sizes: [50, 50] },
cta: { required: false }
}
},
bids: [
{
bidder: 'eHealthcareSolutions',
params: {
placement_id: 111519, // Required parameter
bid_floor: 1 // Optional parameter
}
}
]
}
];
```
--------------------------------
### Video Heroes Video Ad Unit Configuration
Source: https://github.com/prebid/prebid.js/blob/master/modules/videoheroesBidAdapter.md
Example configuration for a video ad unit with the Video Heroes bidder. This setup specifies video player parameters such as duration, player size, and supported protocols.
```javascript
var adUnits = [{
code: 'videoheroes-video-prebid',
mediaTypes: {
video: {
minduration:1,
maxduration:999,
boxingallowed:1,
skip:0,
mimes:[
'application/javascript',
'video/mp4'
],
playerSize: [[768, 1024]],
protocols:[
2,3
],
linearity:1,
api:[1,
2
]
}
},
bids: [{
bidder: 'videoheroes',
params: {
placementId : "1a8d9c22db19906cb8a5fd4518d05f62" // test placementId, please replace after test
}
}]
}];
```
--------------------------------
### Configure Start.io User Sync with Iframe
Source: https://github.com/prebid/prebid.js/blob/master/modules/startioBidAdapter.md
Enable iframe-based user syncing for the Start.io bidder by configuring `userSync.filterSettings` in Prebid.js.
```javascript
pbjs.setConfig({
userSync: {
userIds: [{
name: 'startioId',
storage: {
type: 'cookie&html5',
name: 'startioId'
}
}],
filterSettings: {
iframe: {
bidders: ['startio'],
filter: 'include'
}
}
}
});
```
--------------------------------
### Testing Sirdata RTD Provider Integration
Source: https://github.com/prebid/prebid.js/blob/master/modules/sirdataRtdProvider.md
Command to start a local development server with the necessary modules for testing the Sirdata RTD Provider integration. Also provides the URL to access the integration example in a browser.
```bash
gulp serve --modules=rtdModule,sirdataRtdProvider,appnexusBidAdapter
```
--------------------------------
### Setting up Ad Server Request
Source: https://github.com/prebid/prebid.js/blob/master/modules/adlooxAdServerVideo.md
This code snippet shows how to set up an ad server request, including handling display tags and refreshing ads using Google Publisher Tag. It specifically demonstrates how to retrieve video bids and build a video URL using `pbjs.adServers.gam.buildVideoUrl` before passing it to the Adloox buildVideoUrl function.
```javascript
function sendAdserverRequest(bids, timedOut, auctionId) {
if (pbjs.initAdserverSet) return;
pbjs.initAdserverSet = true;
// handle display tags as usual
googletag.cmd.push(function() {
pbjs.setTargetingForGPTAsync && pbjs.setTargetingForGPTAsync(adUnits);
googletag.pubads().refresh();
});
// handle the bids on the video adUnit
var videoBids = bids[videoAdUnit.code];
if (videoBids) {
var videoUrl = pbjs.adServers.gam.buildVideoUrl({
adUnit: videoAdUnit,
params: {
iu: '/19968336/prebid_cache_video_adunit',
cust_params: {
section: 'blog',
anotherKey: 'anotherValue'
},
output: 'vast'
}
});
pbjs.adServers.adloox.buildVideoUrl({
adUnit: videoAdUnit,
url: videoUrl
}, invokeVideoPlayer);
}
}
```
--------------------------------
### SmartyAds Ad Unit Configurations
Source: https://github.com/prebid/prebid.js/blob/master/modules/smartyadsBidAdapter.md
Example ad unit configurations for SmartyAds, demonstrating setups for native, banner, and video ad formats. Ensure correct parameters like sourceid, accountid, traffic, and region are provided.
```javascript
var adUnits = [
// Will return static native ad. Assets are stored through user UI for each placement separetly
{
code: 'placementId_0',
mediaTypes: {
native: {}
},
bids: [
{
bidder: 'smartyads',
params: {
host: 'prebid',
sourceid: '0',
accountid: '0',
traffic: 'native',
region: 'US_EAST'
}
}
]
},
// Will return static test banner
{
code: 'placementId_0',
mediaTypes: {
banner: {
sizes: [[300, 250]],
}
},
bids: [
{
bidder: 'smartyads',
params: {
host: 'prebid',
sourceid: '0',
accountid: '0',
traffic: 'banner',
region: 'US_EAST'
}
}
]
},
// Will return test vast xml. All video params are stored under placement in publishers UI
{
code: 'placementId_0',
mediaTypes: {
video: {
playerSize: [640, 480],
context: 'instream'
}
},
bids: [
{
bidder: 'smartyads',
params: {
host: 'prebid',
sourceid: '0',
accountid: '0',
traffic: 'video',
region: 'US_EAST'
}
}
]
}
];
```
--------------------------------
### Sample Ad Unit Configuration for Publishers
Source: https://github.com/prebid/prebid.js/blob/master/modules/proxistoreBidAdapter.md
Example of how to configure ad units for the Proxistore adapter. Requires 'website' and 'language' parameters, which must be obtained from Proxistore.
```javascript
var adUnits = [
{
code: 'half-page',
mediaTypes: {
banner: {
sizes: [[300,600]]
}
},
bids: [
{
bidder: 'proxistore',
params: {
website: 'example.com',
language: 'fr'
}
}]
},
{
code: 'rectangle',
mediaTypes: {
banner: {
sizes: [[300,250]]
}
},
bids: [{
bidder: 'proxistore',
params: {
website: 'example.com',
language: 'fr'
}
}]
},
{
code: 'leaderboard',
mediaTypes: {
banner: {
sizes: [[970,250]]
}
},
bids: [{
bidder: 'proxistore',
params: {
website: 'example.com',
language: 'fr'
}
}]
}
];
```
--------------------------------
### Nobid Ad Unit Configuration
Source: https://github.com/prebid/prebid.js/blob/master/modules/nobidBidAdapter.md
Example of how to configure ad units for the Nobid bidder. Ensure the `siteId` parameter is correctly set as provided by your Nobid account manager. This setup supports both display and mobile banner sizes.
```javascript
var adUnits = [
{
code: 'test-div',
mediaTypes: {
banner: {
sizes: [[300, 250]], // a display size
}
},
bids: [
{
bidder: "nobid",
params: {
siteId: 2
}
}
]
},{
code: 'test-div',
mediaTypes: {
banner: {
sizes: [[320, 50]], // a mobile size
}
},
bids: [
{
bidder: "nobid",
params: {
siteId: 2
}
}
]
}
];
```
--------------------------------
### Basic Prebid.js Banner Example with AstraOne
Source: https://github.com/prebid/prebid.js/blob/master/modules/astraoneBidAdapter.md
A complete HTML page demonstrating how to integrate Prebid.js with the AstraOne adapter for a banner ad. It includes script includes, ad unit setup, bid requests, and rendering logic.
```html
Prebid.js Banner Example
Prebid.js InImage Banner Test
```
--------------------------------
### Configure Instream Video Ad Unit for Start.io
Source: https://github.com/prebid/prebid.js/blob/master/modules/startioBidAdapter.md
Set up an instream video ad unit for Start.io, including player and video format specifications along with bidder parameters.
```javascript
var videoAdUnits = [
{
code: 'test-div-video',
mediaTypes: {
video: {
context: 'instream',
placement: 1,
playerSize: [640, 360],
mimes: ['video/mp4'],
protocols: [2, 3, 5, 6],
api: [2],
maxduration: 30,
linearity: 1,
playbackmethod: [2]
}
},
bids: [
{
bidder: 'startio',
params: {
publisherId: 'your-account-id',
testAdsEnabled: true
}
}
]
}
];
```
--------------------------------
### Setting up Ad Units and Event Listeners
Source: https://github.com/prebid/prebid.js/blob/master/integrationExamples/videoModule/videojs/bidRequestScheduling.html
Configure ad units and set up event listeners for 'videoSetupComplete', 'videoSetupFailed', 'videoContentLoaded', 'videoTime', and 'videoAdError'. This is crucial for managing the video player's lifecycle and scheduling bid requests.
```javascript
var adUnits = [
{
"code": "video-1",
"mediaTypes": {
"video": {
"playerSize": [[640, 480]]
}
},
"bids": [
{
"bidder": "appnexus",
"params": {
"placementId": 12345678
}
}
]
}
];
pbjs.addAdUnits(adUnits);
pbjs.onEvent('videoSetupComplete', e => {
// Load media with its Metadata when the video player is done instantiating.
videojs('player').loadMedia({
id: 'XYXYXYXY',
src: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
title: 'Subaru Outback On Street And Dirt',
description: 'Smoking Tire takes the all-new Subaru Outback to the highest point we can find in hopes our customer-appreciation Balloon Launch will get some free T-shirts into the hands of our viewers.',
type: 'video/mp4'
});
});
pbjs.onEvent('videoSetupFailed', e => {
console.log('player setup failed: ', e);
});
pbjs.onEvent('videoContentLoaded', (e) => {
// reset the offset when media is loaded
midrollOffset = 0;
});
pbjs.onEvent('videoTime', (e) => {
// when the video reaches the midroll, request bids and update the offset.
if (e.position >= midrollOffset) {
pbjs.requestBids();
midrollOffset += 10;
}
});
pbjs.onEvent('videoAdError', e => {
console.log('adError: ', e);
});
```
--------------------------------
### RTB Stack Bidder Adapter Test Parameters
Source: https://github.com/prebid/prebid.js/blob/master/modules/admixerBidAdapter.md
Configure ad units for the RTB Stack bidder. Use 'rtbstack' as the bidder code and provide the 'tagId' parameter. This example demonstrates setup for banner and video ad formats.
```javascript
var adUnits = [
{
code: 'desktop-banner-ad-div',
sizes: [[300, 250]], // a display size
bids: [
{
bidder: "rtbstack",
params: {
tagId: 41512
}
}
]
},{
code: 'mobile-banner-ad-div',
sizes: [[300, 50]], // a mobile size
bids: [
{
bidder: "rtbstack",
params: {
tagId: 41512
}
}
]
},{
code: 'video-ad',
sizes: [[300, 50]],
mediaType: 'video',
bids: [
{
bidder: "rtbstack",
params: {
tagId: 41512
}
}
]
},
];
```
--------------------------------
### Yieldlab Multi-Format Ad Unit Setup
Source: https://github.com/prebid/prebid.js/blob/master/modules/yieldlabBidAdapter.md
Example configuration for setting up multi-format ad units with Yieldlab. Ensure at least one eligible Adslot is defined for each media type (e.g., banner, native) within the ad unit configuration.
```javascript
const adUnit = {
code: 'multi-format-adslot',
mediaTypes: {
banner: {
sizes: [ [ 728, 90 ] ]
},
native: {
// native config
}
},
bids: [
// banner Adslot
{ bidder: 'yieldlab', params: { adslotId: '1234', supplyId: '42' } },
// native Adslot
{ bidder: 'yieldlab', params: { adslotId: '2345', supplyId: '42' } }
]
};
```