{"__v":0,"_id":"589e4c898f6d780f00fc44e5","category":{"__v":14,"_id":"55e89569cdbb8a350096df9c","pages":["55e896ac4535442d00ccacf3","55e8b205f0f1850d00d24a59","55e8b243720fde1700659a0e","55e8b4258c0c601700f978e0","55e8b5537cdf7119002d2e3a","55e8b5737cdf7119002d2e3c","55e8b5863fef5017000dbd9f","55e8b59ef0f1850d00d24a63","563b50349e3f2225009fd296","5640d891d4b2e00d00bb3d48","564cfd4e2248461700bd4021","5660e89689e82f0d008f6832","5668d3428ff3da0d0079092f","56abb944f25f160d00e17f40"],"project":"5429beef1163360800ed31fa","version":"5429beef1163360800ed31fd","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-09-03T18:46:01.692Z","from_sync":false,"order":1,"slug":"sdk-integrations","title":"Integrating for Web"},"parentDoc":null,"project":"5429beef1163360800ed31fa","user":"5625457f23053b2300f596c9","version":{"__v":21,"_id":"5429beef1163360800ed31fd","project":"5429beef1163360800ed31fa","createdAt":"2014-09-29T20:19:59.904Z","releaseDate":"2014-09-29T20:19:59.904Z","categories":["5429beef1163360800ed31fe","55e74e1f5d36b32b002563fa","55e7500a73169617001f2e86","55e76b8196131b2f00bf4b72","55e89569cdbb8a350096df9c","55f8935eb089b71700a8364e","55f8a67d3bb4bb0d0022d093","55f9dbefc7ef770d00d9bf6d","5601c21a22ecf60d002b27b3","5601c21ff12aee0d001bb06e","5601c2256c7b610d00280db5","5601c22c22ecf60d002b27b4","5603738d0c78b00d0039af47","5626f70bfcbbc621004ebf52","566f7a1ae144ab0d00e9732f","566f85ca7820960d00c3b93d","56708ce43a32d20d00c45cbf","56708d436995210d003aad8e","5736471abe10a9200030732c","57a82c7aff9bd30e00a6f1c1","591b8500e3992319007190f4"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-02-10T23:28:09.113Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":true,"order":16,"body":"*Please read the RenderJS v2 documentation before proceeding with header bidding setup - https://dev.adsnative.com/v1.0/docs/renderjs-v2-api*\n\nAdsNative has extended [PrebidJS](http://prebid.org/) for the header bidding support, so the setup of Header bidding SSPs looks very similar to what it would in PrebidJS. There are two types of setup you can do,\n\n1. Setting up Header Bidding SSPs with AdsNative: In this case you can configure any SSP which supports PrebidJS integration and AdsNative will conduct the auction on the client side based on the real-time pricing received from respective SSPs and choosing one with the highest price. Publisher's don't have to create any N number of dummy campaigns which are targeted by key-value pairs, which they would in case of DFP/AdX setup. \n\n2. Setting up SSPs and AdsNative with DFP/AdX: In this case you can setup AdsNative and all the partners that fall into server-side unified auctioning along with the SSPs which only support client-side header bidding integration and integrate with DFP/AdX demand. Publisher would setup various buckets of line items in DFP for each SSP and also AdsNative just like the setup with PrebidJS\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Setting up Header Bidding SSPs with AdsNative\"\n}\n[/block]\nOnly difference with respect to RenderJS v2 implementation is, in initialization you will have to include PrebidJS and AdsNative tags in the header of your page and also have configure all the adUnits which need to be enabled for header bidding with their respective configurations. You can notice in the example that RenderJS use `apiKey` mentioned in the `headerBidAdUnits` configuration to match it with the corresponding AdsNative ad-unit. This is only thing publisher has to implement to enable header bidding SSPs with AdsNative. There is no need for any configuration inside AdsNative platform. Following is an example,\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<!DOCTYPE html>\\n<html>\\n  <head>\\n    <script> \\n        var adsnativetag = adsnativetag || {};\\n        adsnativetag.cmdQ = adsnativetag.cmdQ || [];\\n        adsnativetag.cmdQ.push(function(){\\n          adsnativetag.updateConfig({\\n            keyValues: {\\n              pageTags: ['sports']\\n            }\\n          });\\n        });\\n    </script>\\n    <script async='async' type='text/javascript' src='//static.adsnative.com/static/js/prebid.js'></script>\\n    <script async='async' type='text/javascript' src='//static.adsnative.com/static/js/render.v2.js'></script>\\n    <script>\\n      var headerBidAdUnits = [{\\n\\t        apiKey: '[REPLACE_WITH_YOUR_DEMO1_API_KEY]',\\n\\t        sizes: [[300, 250], [300, 600]],\\n\\t        bids: [{\\n                bidder: 'appnexus',\\n                params: {\\n                   placementId: '10433394'\\n                }\\n            }]\\n\\t    }];\\n      \\n      adsnativetag.cmdQ.push(function(){\\n        adsnativetag.defineHeaderBidAdUnits(headerBidAdUnits); \\n        \\n        window.demoAdUnit1 = adsnativetag.defineAdUnit({\\n          apiKey: '[REPLACE_WITH_YOUR_DEMO1_API_KEY]'\\n        });\\n        \\n        adsnativetag.requestAds();\\n      });\\n    </script>\\n  </head>\\n  <body>\\n    \\n    <!-- ANY CONTENT -->\\n    \\n    <h2>AdsNative Demo Ad 1</h2>\\n    <div id='div-an-ad-1'>\\n        <script type='text/javascript'>\\n            adsnativetag.cmdQ.push(function() { var display_status = adsnativetag.displayAdUnit(demoAdUnit1, 'div-an-ad-1'); });\\n        </script>\\n    </div>\\n    \\n    <!-- ANY CONTENT -->\\n    \\n  </body>\\n</html>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2. Setting up SSPs and AdsNative with DFP/AdX for Header Bidding\"\n}\n[/block]\nIn case you want to integrate AdsNative with all its server-side partners into DFP/AdX along with other header bidding SSPs, the configuration looks very similar to above except now you will have to specify DFP ad unit code in the `headerBidAdUnits` config and also create the line items for each CPM buckets of 10 cents with respective key-value targeting. For the DFP Ad Ops setup please refer to this document - http://prebid.org/adops.html. Following is an example implementation,\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<!DOCTYPE html>\\n<html>\\n  <head>\\n    <script> \\n        var adsnativetag = adsnativetag || {};\\n        adsnativetag.cmdQ = adsnativetag.cmdQ || [];\\n        adsnativetag.cmdQ.push(function(){\\n          adsnativetag.updateConfig({\\n            keyValues: {\\n              pageTags: ['sports']\\n            }\\n          });\\n        });\\n    </script>\\n    <script async='async' type='text/javascript' src='//static.adsnative.com/static/js/prebid.js'></script>\\n    <script async='async' type='text/javascript' src='//static.adsnative.com/static/js/render.v2.js'></script>\\n    <script>\\n      var googletag = googletag || {};\\n    \\tgoogletag.cmd = googletag.cmd || [];\\n    \\tgoogletag.cmd.push(function() {\\n        \\tgoogletag.pubads().disableInitialLoad();\\n    \\t});\\n      \\n      var headerBidAdUnits = [{\\n        \\tcode: 'div-gpt-ad-1438287399331-0',\\n\\t        apiKey: '[REPLACE_WITH_YOUR_DEMO1_API_KEY]',\\n\\t        sizes: [[300, 250], [300, 600]],\\n\\t        bids: [{\\n                bidder: 'appnexus',\\n                params: {\\n                   placementId: '10433394'\\n                }\\n            }]\\n\\t    }];\\n      \\n      adsnativetag.cmdQ.push(function(){\\n        adsnativetag.defineHeaderBidAdUnits(headerBidAdUnits); \\n        \\n        window.demoAdUnit1 = adsnativetag.defineAdUnit({\\n          apiKey: '[REPLACE_WITH_YOUR_DEMO1_API_KEY]'\\n        });\\n        \\n        adsnativetag.requestAds();\\n      });\\n      \\n      googletag.cmd.push(function () {\\n\\t  \\t\\t\\tgoogletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1438287399331-0').addService(googletag.pubads());\\n\\t        googletag.pubads().enableSingleRequest();\\n\\t        googletag.enableServices();\\n\\t    });\\n    </script>\\n  </head>\\n  <body>\\n    \\n    <!-- ANY CONTENT -->\\n    \\n    <h2>AdsNative Demo Ad 1</h2>\\n    <div id='div-gpt-ad-1438287399331-0'>\\n      <script type='text/javascript'>\\n          googletag.cmd.push(function() { googletag.display('div-gpt-ad-1438287399331-0'); });\\n      </script>\\n  \\t</div>\\n    \\n    <!-- ANY CONTENT -->\\n    \\n  </body>\\n</html>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"renderjs-v2-header-bidding","type":"basic","title":"RenderJS v2 Header Bidding"}

RenderJS v2 Header Bidding


*Please read the RenderJS v2 documentation before proceeding with header bidding setup - https://dev.adsnative.com/v1.0/docs/renderjs-v2-api* AdsNative has extended [PrebidJS](http://prebid.org/) for the header bidding support, so the setup of Header bidding SSPs looks very similar to what it would in PrebidJS. There are two types of setup you can do, 1. Setting up Header Bidding SSPs with AdsNative: In this case you can configure any SSP which supports PrebidJS integration and AdsNative will conduct the auction on the client side based on the real-time pricing received from respective SSPs and choosing one with the highest price. Publisher's don't have to create any N number of dummy campaigns which are targeted by key-value pairs, which they would in case of DFP/AdX setup. 2. Setting up SSPs and AdsNative with DFP/AdX: In this case you can setup AdsNative and all the partners that fall into server-side unified auctioning along with the SSPs which only support client-side header bidding integration and integrate with DFP/AdX demand. Publisher would setup various buckets of line items in DFP for each SSP and also AdsNative just like the setup with PrebidJS [block:api-header] { "type": "basic", "title": "1. Setting up Header Bidding SSPs with AdsNative" } [/block] Only difference with respect to RenderJS v2 implementation is, in initialization you will have to include PrebidJS and AdsNative tags in the header of your page and also have configure all the adUnits which need to be enabled for header bidding with their respective configurations. You can notice in the example that RenderJS use `apiKey` mentioned in the `headerBidAdUnits` configuration to match it with the corresponding AdsNative ad-unit. This is only thing publisher has to implement to enable header bidding SSPs with AdsNative. There is no need for any configuration inside AdsNative platform. Following is an example, [block:code] { "codes": [ { "code": "<!DOCTYPE html>\n<html>\n <head>\n <script> \n var adsnativetag = adsnativetag || {};\n adsnativetag.cmdQ = adsnativetag.cmdQ || [];\n adsnativetag.cmdQ.push(function(){\n adsnativetag.updateConfig({\n keyValues: {\n pageTags: ['sports']\n }\n });\n });\n </script>\n <script async='async' type='text/javascript' src='//static.adsnative.com/static/js/prebid.js'></script>\n <script async='async' type='text/javascript' src='//static.adsnative.com/static/js/render.v2.js'></script>\n <script>\n var headerBidAdUnits = [{\n\t apiKey: '[REPLACE_WITH_YOUR_DEMO1_API_KEY]',\n\t sizes: [[300, 250], [300, 600]],\n\t bids: [{\n bidder: 'appnexus',\n params: {\n placementId: '10433394'\n }\n }]\n\t }];\n \n adsnativetag.cmdQ.push(function(){\n adsnativetag.defineHeaderBidAdUnits(headerBidAdUnits); \n \n window.demoAdUnit1 = adsnativetag.defineAdUnit({\n apiKey: '[REPLACE_WITH_YOUR_DEMO1_API_KEY]'\n });\n \n adsnativetag.requestAds();\n });\n </script>\n </head>\n <body>\n \n <!-- ANY CONTENT -->\n \n <h2>AdsNative Demo Ad 1</h2>\n <div id='div-an-ad-1'>\n <script type='text/javascript'>\n adsnativetag.cmdQ.push(function() { var display_status = adsnativetag.displayAdUnit(demoAdUnit1, 'div-an-ad-1'); });\n </script>\n </div>\n \n <!-- ANY CONTENT -->\n \n </body>\n</html>", "language": "html" } ] } [/block] [block:api-header] { "type": "basic", "title": "2. Setting up SSPs and AdsNative with DFP/AdX for Header Bidding" } [/block] In case you want to integrate AdsNative with all its server-side partners into DFP/AdX along with other header bidding SSPs, the configuration looks very similar to above except now you will have to specify DFP ad unit code in the `headerBidAdUnits` config and also create the line items for each CPM buckets of 10 cents with respective key-value targeting. For the DFP Ad Ops setup please refer to this document - http://prebid.org/adops.html. Following is an example implementation, [block:code] { "codes": [ { "code": "<!DOCTYPE html>\n<html>\n <head>\n <script> \n var adsnativetag = adsnativetag || {};\n adsnativetag.cmdQ = adsnativetag.cmdQ || [];\n adsnativetag.cmdQ.push(function(){\n adsnativetag.updateConfig({\n keyValues: {\n pageTags: ['sports']\n }\n });\n });\n </script>\n <script async='async' type='text/javascript' src='//static.adsnative.com/static/js/prebid.js'></script>\n <script async='async' type='text/javascript' src='//static.adsnative.com/static/js/render.v2.js'></script>\n <script>\n var googletag = googletag || {};\n \tgoogletag.cmd = googletag.cmd || [];\n \tgoogletag.cmd.push(function() {\n \tgoogletag.pubads().disableInitialLoad();\n \t});\n \n var headerBidAdUnits = [{\n \tcode: 'div-gpt-ad-1438287399331-0',\n\t apiKey: '[REPLACE_WITH_YOUR_DEMO1_API_KEY]',\n\t sizes: [[300, 250], [300, 600]],\n\t bids: [{\n bidder: 'appnexus',\n params: {\n placementId: '10433394'\n }\n }]\n\t }];\n \n adsnativetag.cmdQ.push(function(){\n adsnativetag.defineHeaderBidAdUnits(headerBidAdUnits); \n \n window.demoAdUnit1 = adsnativetag.defineAdUnit({\n apiKey: '[REPLACE_WITH_YOUR_DEMO1_API_KEY]'\n });\n \n adsnativetag.requestAds();\n });\n \n googletag.cmd.push(function () {\n\t \t\t\tgoogletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1438287399331-0').addService(googletag.pubads());\n\t googletag.pubads().enableSingleRequest();\n\t googletag.enableServices();\n\t });\n </script>\n </head>\n <body>\n \n <!-- ANY CONTENT -->\n \n <h2>AdsNative Demo Ad 1</h2>\n <div id='div-gpt-ad-1438287399331-0'>\n <script type='text/javascript'>\n googletag.cmd.push(function() { googletag.display('div-gpt-ad-1438287399331-0'); });\n </script>\n \t</div>\n \n <!-- ANY CONTENT -->\n \n </body>\n</html>", "language": "html" } ] } [/block]