// Prebid-header JS generator v5.0.0 - prebid 8 var pbjs = pbjs || {}; pbjs.que = pbjs.que || []; var googletag_ref; var PREBID_TIMEOUT = 2000; var FAILSAFE_TIMEOUT = 3000; // UAM vars // load the apstag.js library !function(a9,a,p,s,t,A,g){if(a[a9])return;function q(c,r){a[a9]._Q.push([c,r])}a[a9]={init:function(){q("i",arguments)},fetchBids:function(){q("f",arguments)},setDisplayBids:function(){},targetingKeys:function(){return[]},_Q:[]};A=p.createElement(s);A.async=!0;A.src=t;g=p.getElementsByTagName(s)[0];g.parentNode.insertBefore(A,g)}("apstag",window,document,"script","//c.amazon-adsystem.com/aax2/apstag.js"); // initialize the apstag.js library on the page to allow bidding apstag.init({ pubID: '4d82ee98-0c5b-4c96-a74c-68b0a5395433', //enter your pub ID here as shown above, it must within quotes adServer: 'googletag' ,schain: { complete: 1, ver: '1.0', nodes: [ { "asi":"next14.com", "sid":"37983", "hp":1 } ] } }); var adsSlots; function printSlots() { var slots = googletag.pubads().getSlots() for (s in slots) { var slot = slots[s]; var sizes = new Array(); for (z in slot.getSizes()) { var size = slot.getSizes()[z]; sizes.push(new Array(size.l,size.j)); } console.log("Slot '" + slot.getAdUnitPath() + "' -> div '" + slot.getSlotElementId() + "' -> sizes: " + JSON.stringify(sizes)); } } function zdk_isMobile() { return (screen.width <= 1024); } function zdkFindCMP() { var curr = null; var i=0; do { try { i++; if (curr == null) curr = window; else curr = curr.parent; if (typeof curr.__tcfapi === 'function') return true; } catch(err) { console.log("zerr: "+err); } } while (curr !== window.top && i<20); //avoid infinite loop return false; } /* returns [adUnits, adsSlots] */ function aplus_buildAdUnits(googletag) { var slots = new Array(); // parse google slots definition var g_slots = googletag.pubads().getSlots() for (s in g_slots) { var slot = g_slots[s]; var sizes = new Array(); for (z in slot.getSizes()) { var size = slot.getSizes()[z]; sizes.push(new Array(size.l,size.j)); } slots.push({"slot":slot.getAdUnitPath(),"div":slot.getSlotElementId(),"sizes":sizes}); } // generate the adunits & adsSlots var adUnits = new Array(); var adsSlots = new Array(); for (s in slots) { var googleSlot = slots[s]; var aplus_slot_found = aplus_slots.filter(function(el){ return (el.slot==googleSlot.slot); }); if (!aplus_slot_found || aplus_slot_found.length<1) { console.log("slot: "+googleSlot.slot+" not matched"); continue; } var pl_id = (zdk_isMobile())?aplus_slot_found[0].plm:aplus_slot_found[0].pld; var aplus_placement_found = aplus_placements.filter(function(el){ return (el.pl==pl_id); }); if (!aplus_placement_found || aplus_placement_found.length<1) { console.log("placement: "+pl_id+" not found"); continue; } //console.log("found ["+JSON.stringify(aplus_slot_found[0])+"] -> "+JSON.stringify(aplus_placement_found[0])); // add to adUnits var adUnitObj = { code: googleSlot.slot, mediaTypes: { banner: { sizes: aplus_placement_found[0].sizes } }, bids: aplus_placement_found[0].bids }; // if interstitial is enabled, i'll have renderer declared on z_interstitial var if (aplus_slot_found[0].interstitial) { if (typeof z_interstitial !== "undefined") { adUnitObj.renderer = z_interstitial.renderer; } else { console.log("WARN - z_interstitial not defined"); } } adUnits.push(adUnitObj); console.log("slot: "+googleSlot.slot+" - adUnitObj: ",adUnitObj); // add to adsSlots adsSlots.push({ slotID: googleSlot.div, slotName: googleSlot.slot, sizes: aplus_placement_found[0].sizes }); } //console.log("--- slots recreated:"); //console.log(adUnits); //console.log(adsSlots); return [adUnits,adsSlots]; } const zCallback = (tcData, success) => { //console.log("__tcfapi ST: "+tcData.eventStatus); if (success && (tcData.eventStatus === 'tcloaded' || tcData.eventStatus === 'useractioncomplete')) { console.log("__tcfapi CALL ADSERVERS"); zEngineStart(); // remove the ourself to not get called more than once __tcfapi('removeEventListener', 2, (success) => {}, tcData.listenerId); } else { //console.log("__tcfapi ??"); } } // ***** parallel UAM+criteo+pbjs ***** // config/sync object window.hb_status = { n_adserver_callback: [], adserverRequestSent: false, // true once everything has been completed prebidTargetingSet: false }; //if i don't have criteo / uam integration, just set them already done window.hb_status.n_adserver_callback.push("criteo"); function zEngineStart() { pbjs.que.push(function() { console.log("on pbjs PUSH request bids"); // // ===== APS request console.log("===== set aps(UAM) callback"); apstag.fetchBids({ slots: adsSlots, timeout: PREBID_TIMEOUT },function(bids) { console.log("aps handler"); adServerCallback('aps'); }); // ===== Prebid callback console.log("===== set Prebid callback"); pbjs.requestBids({ bidsBackHandler: function() { console.log("prebid handler"); adServerCallback('prebid'); }, timeout: PREBID_TIMEOUT }); // ===== Safety timeout console.log("===== set Safety timeout "); setTimeout(function() { adServerCallback('timeout'); }, FAILSAFE_TIMEOUT); // }); } // ===== Combined callback (this callback will be called by Prebid, Criteo, or timeout) function adServerCallback(source) { console.log("ON adServerCallback ",source); if (window.hb_status.adserverRequestSent) return; // add source to the processed list window.hb_status.n_adserver_callback.push(source); // add this source as "bidderDone" if (source == 'aps') { googletag.cmd.push(function() { console.log("aps SET TARGETING"); apstag.setDisplayBids(); }); } else if (source == 'prebid') { // got prebid config request googletag.cmd.push(function() { pbjs.que.push(function() { console.log("pbjs SET TARGETING"); pbjs.setTargetingForGPTAsync(); // configure targeting for prebid window.hb_status.prebidTargetingSet = true; }); }); } else if (source == 'criteo') { // got criteo config request googletag.cmd.push(function() { console.log("criteo SET TARGETING"); Criteo.SetDFPKeyValueTargeting(); // This will append Criteo keywords to the adserver call }); } // check if i've completed if (window.hb_status.n_adserver_callback.length >= 3) { // if all bids have been completed googletag.pubads().refresh(); window.hb_status.adserverRequestSent = true; googletag.cmd.push(function() { console.log("REFRESH for bidders done"); googletag.pubads().refresh(); // this will will trigger the adserver calls }); } else if ("timeout" == source) { // got timeout (one of prebid or criteo or aps didn't finish in time) window.hb_status.adserverRequestSent = true; googletag.cmd.push(function() { // pbjs.setTargetingForGPTAsync(); MUST be done ANYWAY before googletag.pubads().refresh(); if (!window.hb_status.prebidTargetingSet) { pbjs.que.push(function() { console.log("setTargetingForGPTAsync on timeout"); pbjs.setTargetingForGPTAsync(); // configure targeting for prebid }); } console.log("REFRESH for timeout"); googletag.pubads().refresh(); // this will will trigger the adserver calls }); }; } //called by the html page just before "googletag.enableServices()" and after googletag.defineSlot(...)s function oz_config(googletag) { googletag_ref = googletag; googletag_ref.pubads().disableInitialLoad(); googletag_ref.pubads().enableSingleRequest(); adUnits_adsSlots = aplus_buildAdUnits(googletag_ref); adUnits = adUnits_adsSlots[0]; adsSlots = adUnits_adsSlots[1]; console.log("adUnits & adsSlots:"); console.log(adUnits_adsSlots); pbjs.que.push(function() { // pbjs 1/2 (cfg) configurePBJS(); bidderSettingsPBJS(); // pbjs.destroyAdUnits(); - may be needed for single page applications pbjs.addAdUnits(adUnits); console.log("addAdUnits done"); }); // check whether start the engine or wait for CMP approval/refuse if (zdkFindCMP()) { console.log("__tcfapi - set listener"); __tcfapi('addEventListener', 2, zCallback); //zEngineStart() will be called after CMP approval/refusal } else { console.log("__tcfapi not found - load normally"); zEngineStart(); } //it should be done into the publisher's page just after this line, but better twice that none googletag_ref.enableServices(); } // try to find firstPartyData hints from browser's ua var listOfEntropyValues = null; try { navigator.userAgentData.getHighEntropyValues([ "architecture", "model", "platformVersion", "fullVersionList", ]).then((values) => { listOfEntropyValues = Object.keys(values); console.log("got ua entropy values: "+listOfEntropyValues); }); } catch (error) { console.log("cannot get ua entropy values. leave it blank"); } // NOCMP based on CMP in page detection + userSync iframe enabled with filters function configurePBJS() { /* pbjsConfig */ if (listOfEntropyValues!=null) { console.log("setting ua entropy values: "+listOfEntropyValues); pbjs.setConfig({ firstPartyData: { uaHints: listOfEntropyValues } }); } pbjs.setConfig({ userSync: { filterSettings: { iframe: { bidders: '*', // '*' means all bidders filter: 'include' } } }, gptPreAuction: { enabled: true, // enabled by default }, useBidCache: true, eventHistoryTTL: 60, // maximum time (in seconds) that events should be kept in memory priceGranularity: "dense", firstPartyData: { uaHints: [ "architecture", "model", "platform", "platformVersion", "fullVersionList" ] }, enableTIDs: true, currency: { // enables currency feature "adServerCurrency": "EUR", //"granularityMultiplier": 1, // 0.50 increment up to 5 is fine for GBP... what is that?!?! // until bidder adapters are updated to define the bid currency // the system assumes bids are in USD. This can be overridden, for instance: "bidderCurrencyDefault": { "openx": "EUR" }, "conversionRateFile": "//currency.prebid.org/latest.json" // prebid's lib bug fix - this way allows both http and https }, consentManagement: { gdpr: { cmpApi: 'iab', timeout: 8000, // allowAuctionWithoutConsent: true, defaultGdprScope: true } }, improvedigital: { usePrebidSizes: true }, //rubicon new config: Single-Request optimization rubicon: {singleRequest: true} }); pbjs.setConfig({ "schain": { "validation": "strict", "config": { "ver":"1.0", "complete": 1, "nodes": [ { "asi":"next14.com", "sid":"37983", "hp":1 } ] } } }); // specific adasta stuff) pbjs.setBidderConfig({ "bidders": ['adasta'], "config": { "schain": { "config": { "ver":"1.0", "complete": 1, "nodes" : [ { "asi":"next14.com", "sid":"37983", "hp":1 } ].concat([{"asi":"adasta.it","sid":"13","hp":1}]) } } } }, true); // = merge existing (add to global config) if (!zdkFindCMP()) { // no CMP inside the publiser's page. set "NOCMP" parameters overriding consentManagement console.log("znocmp"); pbjs.setConfig({ consentManagement: { gdpr: { cmpApi: 'static', consentData: { getConsentData: { 'gdprApplies': false } } } } }); } else { console.log("zcmp"); } /* /pbjsConfig */ } function bidderSettingsPBJS() { //console.log("bidderSettings pbjs"); //ssps price adjustment pbjs.bidderSettings = { standard: { storageAllowed: true }, adf: { bidCpmAdjustment : function(bidCpm){ bidCpm = bidCpm * 0.90; return bidCpm; } }, pubmatic: { bidCpmAdjustment : function(bidCpm){ bidCpm = bidCpm * 0.92; return bidCpm; } }, adasta: { bidCpmAdjustment : function(bidCpm){ bidCpm = bidCpm * 0.7; return bidCpm; } } }; pbjs.aliasBidder('appnexus', 'turbo'); pbjs.aliasBidder('appnexus', 'adasta'); pbjs.aliasBidder('ix', 'ix1'); } /* interstitial default properties */ var z_interstitial = { renderer: { url: 'https://secure-assets.rubiconproject.com/utils/prebidInter/prebidInter.min.js', render: function(prebidBid) { this.push(() => { window.interstitial.renderAd({ fullBids: prebidBid, // required, please don't edit or change! overlayColor: "black", // optional, color of the overlay. overlayOpacity: 0.5, // optional, value between 0 and 1 defining the opacity of the overlay. // closeTime: "10", // optional, time in second before the user can close the interstitial. showCloseButtonAfterSeconds: 0 // optional. Time in seconds before the close button appears. }); }); } } }; /* this will be different for each publisher/site */ var aplus_slots = [ {slot:"/57491254/Calcioefinanza.it/AltreNotizie/Ros/MaxTicker",plm:96122,pld:96119}, {slot:"/57491254/Calcioefinanza.it/AltreNotizie/Ros/MPU_Middle",plm:96121,pld:96118}, {slot:"/57491254/Calcioefinanza.it/AltreNotizie/Ros/MPU_Top",plm:96120,pld:96117}, {slot:"/57491254/Calcioefinanza.it/AltreNotizie/Ros/Overlay",plm:96125,interstitial:true}, {slot:"/57491254/Calcioefinanza.it/Finanza/Ros/MaxTicker",plm:96122,pld:96119}, {slot:"/57491254/Calcioefinanza.it/Finanza/Ros/MPU_Middle",plm:96121,pld:96118}, {slot:"/57491254/Calcioefinanza.it/Finanza/Ros/MPU_Top",plm:96120,pld:96117}, {slot:"/57491254/Calcioefinanza.it/Finanza/Ros/Overlay",plm:96125,interstitial:true}, {slot:"/57491254/Calcioefinanza.it/Finanza/Ros/Top",pld:96114}, {slot:"/57491254/Calcioefinanza.it/Governance/Ros/MaxTicker",plm:96122,pld:96119}, {slot:"/57491254/Calcioefinanza.it/Governance/Ros/MPU_Middle",plm:96121,pld:96118}, {slot:"/57491254/Calcioefinanza.it/Governance/Ros/MPU_Top",plm:96120,pld:96117}, {slot:"/57491254/Calcioefinanza.it/Governance/Ros/Overlay",plm:96125,interstitial:true}, {slot:"/57491254/Calcioefinanza.it/Governance/Ros/Top",pld:96114}, {slot:"/57491254/Calcioefinanza.it/Homepage/MaxTicker",plm:96122,pld:96119}, {slot:"/57491254/Calcioefinanza.it/Homepage/MPU_Middle",plm:96121,pld:96118}, {slot:"/57491254/Calcioefinanza.it/Homepage/MPU_Top",plm:96120,pld:96117}, {slot:"/57491254/Calcioefinanza.it/Homepage/Overlay",plm:96125,interstitial:true}, {slot:"/57491254/Calcioefinanza.it/Homepage/Top",pld:96114}, {slot:"/57491254/Calcioefinanza.it/Marketing/Ros/MaxTicker",plm:96122,pld:96119}, {slot:"/57491254/Calcioefinanza.it/Marketing/Ros/MPU_Middle",plm:96121,pld:96118}, {slot:"/57491254/Calcioefinanza.it/Marketing/Ros/MPU_Top",plm:96120,pld:96117}, {slot:"/57491254/Calcioefinanza.it/Marketing/Ros/Overlay",plm:96125,interstitial:true}, {slot:"/57491254/Calcioefinanza.it/Marketing/Ros/Top",pld:96114}, {slot:"/57491254/Calcioefinanza.it/Media/Ros/MaxTicker",plm:96122,pld:96119}, {slot:"/57491254/Calcioefinanza.it/Media/Ros/MPU_Middle",plm:96121,pld:96118}, {slot:"/57491254/Calcioefinanza.it/Media/Ros/MPU_Top",plm:96120,pld:96117}, {slot:"/57491254/Calcioefinanza.it/Media/Ros/Overlay",plm:96125,interstitial:true}, {slot:"/57491254/Calcioefinanza.it/Media/Ros/Top",pld:96114}, {slot:"/57491254/Calcioefinanza.it/Ros/MaxTicker",plm:96122,pld:96119}, {slot:"/57491254/Calcioefinanza.it/Ros/MPU_Middle",plm:96121,pld:96118}, {slot:"/57491254/Calcioefinanza.it/Ros/MPU_Top",plm:96120,pld:96117}, {slot:"/57491254/Calcioefinanza.it/Ros/Overlay",plm:96125,interstitial:true}, {slot:"/57491254/Calcioefinanza.it/Ros/Top",pld:96114}, {slot:"/57491254/Calcioefinanza.it/sport_e_finanza/Ros/MaxTicker",plm:96122,pld:96119}, {slot:"/57491254/Calcioefinanza.it/sport_e_finanza/Ros/MPU_Middle",plm:96121,pld:96118}, {slot:"/57491254/Calcioefinanza.it/sport_e_finanza/Ros/MPU_Top",plm:96120,pld:96117}, {slot:"/57491254/Calcioefinanza.it/sport_e_finanza/Ros/Overlay",plm:96125,interstitial:true}, {slot:"/57491254/Calcioefinanza.it/sport_e_finanza/Ros/Top",pld:96114}, {slot:"/57491254/Calcioefinanza.it/SportNEXT/Ros/MaxTicker",plm:96122,pld:96119}, {slot:"/57491254/Calcioefinanza.it/SportNEXT/Ros/MPU_Middle",plm:96121,pld:96118}, {slot:"/57491254/Calcioefinanza.it/SportNEXT/Ros/MPU_Top",plm:96120,pld:96117}, {slot:"/57491254/Calcioefinanza.it/SportNEXT/Ros/Overlay",plm:96125,interstitial:true}, {slot:"/57491254/Calcioefinanza.it/SportNEXT/Ros/Top",pld:96114}, {slot:"/57491254/Calcioefinanza.it/Stadi/Ros/MaxTicker",plm:96122,pld:96119}, {slot:"/57491254/Calcioefinanza.it/Stadi/Ros/MPU_Middle",plm:96121,pld:96118}, {slot:"/57491254/Calcioefinanza.it/Stadi/Ros/MPU_Top",plm:96120,pld:96117}, {slot:"/57491254/Calcioefinanza.it/Stadi/Ros/Overlay",plm:96125,interstitial:true}, {slot:"/57491254/Calcioefinanza.it/Stadi/Ros/Top",pld:96114}, {slot:"/57491254/Calcioefinanza.it/Europei_Calcio/Ros/MaxTicker",plm:96122,pld:96119}, {slot:"/57491254/Calcioefinanza.it/Europei_Calcio/Ros/MPU_Middle",plm:96121,pld:96118}, {slot:"/57491254/Calcioefinanza.it/Europei_Calcio/Ros/MPU_Top",plm:96120,pld:96117}, {slot:"/57491254/Calcioefinanza.it/Europei_Calcio/Ros/Overlay",plm:96125,interstitial:true}, {slot:"/57491254/Calcioefinanza.it/Europei_Calcio/Ros/Top",pld:96114} ]; var aplus_placements = [ {pl:96122,sizes:[[320, 50],[320, 100]],bids:[{bidder:'appnexus', params:{placementId:'29844549'}},{bidder:'criteo', params:{networkId:6093}},{bidder:'adasta', params:{placementId:'30523432'}},{bidder:'ogury', params:{adUnitId:'wm-hb-head-calcio-nextp-3vavsyk9ojwl',assetKey: 'OGY-910F9C5381B4'}},{bidder:'rubicon', params:{accountId:'13258',siteId:'70942',zoneId:'2853576',sizes:[43,117]}},{bidder:'adf', params:{mid:'1686136',rcur:'USD'}}]}, {pl:96119,sizes:[[728, 90],[970, 250],[990, 250],[990, 30]],bids:[{bidder:'appnexus', params:{placementId:'29844542'}},{bidder:'criteo', params:{networkId:6093}},{bidder:'adasta', params:{placementId:'30523427'}},{bidder:'rubicon', params:{accountId:'13258',siteId:'70942',zoneId:'2853570',sizes:[2,57]}},{bidder:'adf', params:{mid:'1686132',rcur:'USD'}}]}, {pl:96121,sizes:[[300, 250]],bids:[{bidder:'appnexus', params:{placementId:'29844548'}},{bidder:'criteo', params:{networkId:6093}},{bidder:'adasta', params:{placementId:'30523435'}},{bidder:'rubicon', params:{accountId:'13258',siteId:'70942',zoneId:'2853574',sizes:[15]}},{bidder:'adf', params:{mid:'1686135',rcur:'USD'}}]}, {pl:96118,sizes:[[300, 250],[300, 600]],bids:[{bidder:'appnexus', params:{placementId:'29844540'}},{bidder:'criteo', params:{networkId:6093}},{bidder:'adasta', params:{placementId:'30523430'}},{bidder:'rubicon', params:{accountId:'13258',siteId:'70942',zoneId:'2853568',sizes:[15,10]}},{bidder:'adf', params:{mid:'1686131',rcur:'USD'}}]}, {pl:96120,sizes:[[300, 250]],bids:[{bidder:'appnexus', params:{placementId:'29844547'}},{bidder:'criteo', params:{networkId:6093}},{bidder:'adasta', params:{placementId:'30523434'}},{bidder:'ogury', params:{adUnitId:'wm-hb-iart-calcio-nextp-sbyllksudane',assetKey: 'OGY-910F9C5381B4'}},{bidder:'rubicon', params:{accountId:'13258',siteId:'70942',zoneId:'2853572',sizes:[15]}},{bidder:'adf', params:{mid:'1686133',rcur:'USD'}}]}, {pl:96117,sizes:[[300, 250],[300, 600]],bids:[{bidder:'appnexus', params:{placementId:'29844539'}},{bidder:'criteo', params:{networkId:6093}},{bidder:'adasta', params:{placementId:'30523428'}},{bidder:'rubicon', params:{accountId:'13258',siteId:'70942',zoneId:'2853566',sizes:[15,10]}},{bidder:'adf', params:{mid:'1686130',rcur:'USD'}}]}, {pl:96125,sizes:[[320, 480]],bids:[{bidder:'appnexus', params:{placementId:'29871538'}},{bidder:'criteo', params:{networkId:6093}},{bidder:'rubicon', params:{accountId:'13258',siteId:'70942',zoneId:'2853580',sizes:[67]}}]}, {pl:96114,sizes:[[1, 1]],bids:[{bidder:'appnexus', params:{placementId:'29844340'}},{bidder:'rubicon', params:{accountId:'13258',siteId:'70942',zoneId:'2853564',sizes:[221]}}]} ];