|
| 1 | +<html> |
| 2 | +<head> |
| 3 | + <script> |
| 4 | + (function(window, document) { |
| 5 | + if (!window.__cmp) { |
| 6 | + window.__cmp = (function() { |
| 7 | + var listen = window.attachEvent || window.addEventListener; |
| 8 | + listen('message', function(event) { |
| 9 | + window.__cmp.receiveMessage(event); |
| 10 | + }, false); |
| 11 | + |
| 12 | + function addLocatorFrame() { |
| 13 | + if (!window.frames['__cmpLocator']) { |
| 14 | + if (document.body) { |
| 15 | + var frame = document.createElement('iframe'); |
| 16 | + frame.style.display = 'none'; |
| 17 | + frame.name = '__cmpLocator'; |
| 18 | + document.body.appendChild(frame); |
| 19 | + } else { |
| 20 | + setTimeout(addLocatorFrame, 5); |
| 21 | + } |
| 22 | + } |
| 23 | + } |
| 24 | + addLocatorFrame(); |
| 25 | + |
| 26 | + var commandQueue = []; |
| 27 | + var cmp = function(command, parameter, callback) { |
| 28 | + if (command === 'ping') { |
| 29 | + if (callback) { |
| 30 | + callback({ |
| 31 | + gdprAppliesGlobally: !!(window.__cmp && window.__cmp.config && window.__cmp.config.storeConsentGlobally), |
| 32 | + cmpLoaded: false |
| 33 | + }); |
| 34 | + } |
| 35 | + } else { |
| 36 | + commandQueue.push({ |
| 37 | + command: command, |
| 38 | + parameter: parameter, |
| 39 | + callback: callback |
| 40 | + }); |
| 41 | + } |
| 42 | + }; |
| 43 | + cmp.commandQueue = commandQueue; |
| 44 | + cmp.receiveMessage = function(event) { |
| 45 | + var data = event && event.data && event.data.__cmpCall; |
| 46 | + if (data) { |
| 47 | + commandQueue.push({ |
| 48 | + callId: data.callId, |
| 49 | + command: data.command, |
| 50 | + parameter: data.parameter, |
| 51 | + event: event |
| 52 | + }); |
| 53 | + } |
| 54 | + }; |
| 55 | + cmp.config = { |
| 56 | + // |
| 57 | + // Modify config values here |
| 58 | + // |
| 59 | + // globalVendorListLocation: 'https://vendorlist.consensu.org/vendorlist.json', |
| 60 | + // customPurposeListLocation: './purposes.json', |
| 61 | + // globalConsentLocation: './portal.html', |
| 62 | + // storeConsentGlobally: false, |
| 63 | + // storePublisherData: false, |
| 64 | + logging: 'debug'//, |
| 65 | + // localization: {}, |
| 66 | + // forceLocale: 'en-us' |
| 67 | + }; |
| 68 | + return cmp; |
| 69 | + }()); |
| 70 | + var t = document.createElement('script'); |
| 71 | + t.async = false; |
| 72 | + t.src = 'http://acdn.adnxs.com/cmp/cmp.bundle.js'; |
| 73 | + var tag = document.getElementsByTagName('head')[0]; |
| 74 | + tag.appendChild(t); |
| 75 | + } |
| 76 | + })(window, document); |
| 77 | + // window.__cmp('showConsentTool'); |
| 78 | + </script> |
| 79 | + |
| 80 | + <script> |
| 81 | + var FAILSAFE_TIMEOUT = 2000; |
| 82 | + |
| 83 | + var adUnits = [ |
| 84 | + { |
| 85 | + code: 'test-div', |
| 86 | + mediaTypes: { |
| 87 | + banner: { |
| 88 | + sizes: [[300,250],[300,600],[728,90]] |
| 89 | + } |
| 90 | + }, |
| 91 | + |
| 92 | + bids: [ |
| 93 | + { |
| 94 | + bidder: 'rubicon', |
| 95 | + params: { |
| 96 | + accountId: '1001', |
| 97 | + siteId: '113932', |
| 98 | + zoneId: '535510' |
| 99 | + } |
| 100 | + } |
| 101 | + ] |
| 102 | + } |
| 103 | + ]; |
| 104 | + |
| 105 | + var pbjs = pbjs || {}; |
| 106 | + pbjs.que = pbjs.que || []; |
| 107 | + </script> |
| 108 | + <script src="../../build/dev/prebid.js" async></script> |
| 109 | + |
| 110 | + <script> |
| 111 | + var googletag = googletag || {}; |
| 112 | + googletag.cmd = googletag.cmd || []; |
| 113 | + googletag.cmd.push(function() { |
| 114 | + googletag.pubads().disableInitialLoad(); |
| 115 | + }); |
| 116 | + |
| 117 | + pbjs.que.push(function() { |
| 118 | + pbjs.setConfig({ |
| 119 | + debug: true, |
| 120 | + consentManagement: { |
| 121 | + cmpApi: 'iab', |
| 122 | + timeout: 1000, |
| 123 | + allowAuctionWithoutConsent: true |
| 124 | + }, |
| 125 | + // consentManagement: { |
| 126 | + // cmpApi: 'static', |
| 127 | + // consentData: { |
| 128 | + // consentString: 'BOEFEAyOEFEAyAHABDENAI4AAAB9vABAASA' |
| 129 | + // vendorData: { |
| 130 | + // purposeConsents: { |
| 131 | + // '1': true |
| 132 | + // } |
| 133 | + // } |
| 134 | + // } |
| 135 | + // }, |
| 136 | + usersync: { |
| 137 | + userIds: [{ |
| 138 | + name: "unifiedId", |
| 139 | + params: { |
| 140 | + partner: "prebid", |
| 141 | + url: "http://match.adsrvr.org/track/rid?ttd_pid=prebid&fmt=json" |
| 142 | + }, |
| 143 | + storage: { |
| 144 | + type: "html5", |
| 145 | + name: "unifiedid", |
| 146 | + expires: 30 |
| 147 | + }, |
| 148 | + }, { |
| 149 | + name: "id5Id", |
| 150 | + params: { |
| 151 | + partner: 173 //Set your real ID5 partner ID here for production, please ask for one at http://id5.io/prebid |
| 152 | + }, |
| 153 | + storage: { |
| 154 | + type: "cookie", |
| 155 | + name: "id5id", |
| 156 | + expires: 90, |
| 157 | + refreshInSeconds: 8*3600 // Refresh frequency of cookies, defaulting to 'expires' |
| 158 | + }, |
| 159 | + |
| 160 | + }, { |
| 161 | + name: "parrableId", |
| 162 | + params: { |
| 163 | + // change to Parrable Partner Client ID(s) you received from the Parrable Partners you are using |
| 164 | + partner: '30182847-e426-4ff9-b2b5-9ca1324ea09b' |
| 165 | + }, |
| 166 | + storage: { |
| 167 | + type: "cookie", |
| 168 | + name: "_parrable_eid", // create a cookie with this name |
| 169 | + expires: 365 // cookie can last for a year |
| 170 | + } |
| 171 | + }, { |
| 172 | + name: "pubCommonId", |
| 173 | + storage: { |
| 174 | + type: "cookie", |
| 175 | + name: "pubcid", |
| 176 | + expires: 365 |
| 177 | + }, |
| 178 | + // value: { |
| 179 | + // foo: '9879878907987', |
| 180 | + // bar:'93939' |
| 181 | + // } |
| 182 | + }, { |
| 183 | + name: 'identityLink', |
| 184 | + params: { |
| 185 | + pid: '14' // Set your real identityLink placement ID here |
| 186 | + }, |
| 187 | + storage: { |
| 188 | + type: 'cookie', |
| 189 | + name: 'idl_env', |
| 190 | + expires: 30 |
| 191 | + } |
| 192 | + }], |
| 193 | + syncDelay: 5000, |
| 194 | + auctionDelay: 1000 |
| 195 | + }, |
| 196 | + realTimeData: { |
| 197 | + auctionDelay: 1000, |
| 198 | + dataProviders: [{name: "audigent"}] |
| 199 | + } |
| 200 | + }); |
| 201 | + pbjs.addAdUnits(adUnits); |
| 202 | + pbjs.requestBids({bidsBackHandler: sendAdserverRequest}); |
| 203 | + }); |
| 204 | + |
| 205 | + function sendAdserverRequest() { |
| 206 | + document.getElementById('tdid').innerHTML = adUnits[0].bids[0].userId['tdid']; |
| 207 | + document.getElementById('audigent_segments').innerHTML = JSON.stringify(adUnits[0].bids[0].realTimeData.audigent_segments); |
| 208 | + |
| 209 | + if (pbjs.adserverRequestSent) return; |
| 210 | + pbjs.adserverRequestSent = true; |
| 211 | + googletag.cmd.push(function() { |
| 212 | + pbjs.que.push(function() { |
| 213 | + pbjs.setTargetingForGPTAsync(); |
| 214 | + googletag.pubads().refresh(); |
| 215 | + }); |
| 216 | + }); |
| 217 | + } |
| 218 | + |
| 219 | + setTimeout(function() { |
| 220 | + sendAdserverRequest(); |
| 221 | + }, FAILSAFE_TIMEOUT); |
| 222 | + </script> |
| 223 | + |
| 224 | + <script> |
| 225 | + (function () { |
| 226 | + var gads = document.createElement('script'); |
| 227 | + gads.async = true; |
| 228 | + gads.type = 'text/javascript'; |
| 229 | + var useSSL = 'https:' == document.location.protocol; |
| 230 | + gads.src = (useSSL ? 'https:' : 'http:') + |
| 231 | + '//www.googletagservices.com/tag/js/gpt.js'; |
| 232 | + var node = document.getElementsByTagName('script')[0]; |
| 233 | + node.parentNode.insertBefore(gads, node); |
| 234 | + })(); |
| 235 | + </script> |
| 236 | + |
| 237 | + <script> |
| 238 | + googletag.cmd.push(function() { |
| 239 | + googletag.defineSlot('/112115922/FL_PB_MedRect', [[300, 250],[300,600]], 'test-div').addService(googletag.pubads()); |
| 240 | + googletag.pubads().enableSingleRequest(); |
| 241 | + googletag.enableServices(); |
| 242 | + }); |
| 243 | + </script> |
| 244 | +</head> |
| 245 | + |
| 246 | +<body> |
| 247 | +<h2>Audigent Segments Prebid</h2> |
| 248 | + |
| 249 | +<div id='test-div'> |
| 250 | + <script> |
| 251 | + googletag.cmd.push(function() { googletag.display('test-div'); }); |
| 252 | + </script> |
| 253 | +</div> |
| 254 | +TDID: |
| 255 | +<div id='tdid'> |
| 256 | +</div> |
| 257 | + |
| 258 | +Audigent Segments: |
| 259 | +<div id='audigent_segments'> |
| 260 | +</div> |
| 261 | +</body> |
| 262 | +</html> |
0 commit comments