//Script generado para newspilothq.com //(() => { const PREBID_TIMEOUT = 4000; const FAILSAFE_TIMEOUT = 10000; const BID_TIMEOUT = 6000; const REFRESH_TIMEOUT = 30000; const SELLER_ID = "0288"; const GOOGLE_MANAGER_ID = '' ?? 'pub-2768830610135793'; var pbjs = window.pbjs || (window.pbjs = { que: [] }); var googletag = window.googletag || (window.googletag = { cmd: [] }); googletag.cmd.push(function () { googletag.pubads().disableInitialLoad(); }); const BrowserWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; const isMobile = BrowserWidth <= 768; const adUnit0 = "div-gpt-ad-1694693822862-0"; const slot0 = "/19136023,22937890666/newspilothq.com/np_sidebar_BTF_ad_desktop_300x600"; const adUnit0Sizes = isMobile ? [ [300, 250], [336, 280] ] : [ [300, 250], [336, 280] ]; const adUnit1 = "div-gpt-ad-1690894920097-0"; const slot1 = "/19136023,22937890666/newspilothq.com/auto_300x250"; const adUnit1Sizes = isMobile ? [ [300, 250], [336, 280] ] : [ [300, 250], [336, 280] ]; const adUnits = isMobile ? [ { code: adUnit0, mediaTypes: { video: { context: "outstream", playerSize: [300, 250], mimes: ["video/mp4"], protocols: [1, 2, 3, 4, 5, 6, 7, 8], playbackmethod: [2], skip: 1, playback_method: ["auto_play_sound_off"], }, banner: { sizes: adUnit0Sizes } }, bids: [ { bidder: "google", params: { } } ], ortb2Imp: { ext: { data: { gpid: slot0, }, }, }, }, { code: adUnit1, mediaTypes: { video: { context: "outstream", playerSize: [300, 250], mimes: ["video/mp4"], protocols: [1, 2, 3, 4, 5, 6, 7, 8], playbackmethod: [2], skip: 1, playback_method: ["auto_play_sound_off"], }, banner: { sizes: adUnit1Sizes } }, bids: [ ], ortb2Imp: { ext: { data: { gpid: slot0, }, }, }, }, ] : [ { code: adUnit0, mediaTypes: { video: { context: "outstream", playerSize: [300, 250], mimes: ["video/mp4"], protocols: [1, 2, 3, 4, 5, 6, 7, 8], playbackmethod: [2], skip: 1, playback_method: ["auto_play_sound_off"], }, banner: { sizes: adUnit0Sizes } }, bids: [ { bidder: "google", params: { } } ], ortb2Imp: { ext: { data: { gpid: slot0, }, }, }, }, { code: adUnit1, mediaTypes: { video: { context: "outstream", playerSize: [300, 250], mimes: ["video/mp4"], protocols: [1, 2, 3, 4, 5, 6, 7, 8], playbackmethod: [2], skip: 1, playback_method: ["auto_play_sound_off"], }, banner: { sizes: adUnit1Sizes } }, bids: [ ], ortb2Imp: { ext: { data: { gpid: slot0, }, }, }, }, ] function loadScript(path, goAsync) { if (!document.querySelector(`script[src='${path}']`)) { const script = document.createElement("script"); script.async = goAsync; script.type = "text/javascript"; script.src = path; document.head.appendChild(script); } } loadScript("https://embi-media.com/prebids/production/prebid.js", false); loadScript("https://securepubads.g.doubleclick.net/tag/js/gpt.js", false); loadScript("https://embi-media.com/hb_resources/teads/teads_cookieless.js"); loadScript("https://a.teads.tv/analytics/tag.js"); loadScript("https://t.seedtag.com/t/7943-0469-01.js"); function styleStickyContainer(container, position) { container.style.position = "fixed"; container.style.bottom = "20px"; container.style.left = position === 'LEFT_SIDE' ? "20px" : "auto"; container.style.right = position === 'RIGHT_SIDE' ? "20px" : "auto"; container.style.zIndex = "9999"; container.style.background = "#ccccccaa"; container.style.boxShadow = "black 0 3px 10px 0"; } function createCloseButton(container) { const closeButton = document.createElement("div"); closeButton.id = `close_${container.id}`; closeButton.textContent = `×`; closeButton.style.position = "absolute"; closeButton.style.right = "0"; closeButton.style.top = "0"; closeButton.style.border = "none"; closeButton.style.background = "white"; closeButton.style.fontSize = "30px"; closeButton.style.lineHeight = "15px"; closeButton.style.length = "30px"; closeButton.style.aspectRatio = "1/1"; closeButton.style.cursor = "pointer"; closeButton.style.boxShadow = "black 0 2px 4px 0"; closeButton.style.borderRadius = "50%"; closeButton.style.transform = "translate(0, calc(-100% - 4px))"; closeButton.onclick = () => { container.style.display = "none"; setTimeout(() => { container.style.display = "flex"; }, 30000) } return closeButton; } function styleContainer(container) { container.style.display = "flex"; container.style.gap = "24px"; container.style.background = "transparent"; } (function() { const type = "DISPLAY_VIDEO_STICKY"; const position = "RIGHT_SIDE" let element; try { element = document.querySelector(`.`); if (!element && type !== "DISPLAY_VIDEO_STICKY") { console.error(`Elemento con class '$' no encontrado en el DOM`); return; } } catch(e) { element = document.createElement("div"); } finally { console.info(element); } const adsContainer0 = document.createElement("div"); styleContainer(adsContainer0); const adDiv0 = document.createElement("div"); adDiv0.id = adUnit0; adsContainer0.appendChild(adDiv0); styleStickyContainer(adsContainer0, "RIGHT_SIDE"); adsContainer0.appendChild(createCloseButton(adsContainer0, "RIGHT_SIDE")); document.body.appendChild(adsContainer0); })(); (function() { const type = "DISPLAY_VIDEO"; const position = "INSERT_BEFORE" let element; try { element = document.querySelector(`.grid-carousel-section.section-splitter`); if (!element && type !== "DISPLAY_VIDEO_STICKY") { console.error(`Elemento con class '$grid-carousel-section.section-splitter' no encontrado en el DOM`); return; } } catch(e) { element = document.createElement("div"); } finally { console.info(element); } const adsContainer1 = document.createElement("div"); styleContainer(adsContainer1); const adDiv1 = document.createElement("div"); adDiv1.id = adUnit1; adsContainer1.appendChild(adDiv1); defaultAdjacentPosition = "afterend"; adjacentPosition = "beforebegin"; element.insertAdjacentElement(adjacentPosition, adsContainer1); })(); const customConfigObject = { buckets: [ { precision: 2, min: 0, max: 5, increment: 0.01 }, { precision: 2, min: 5, max: 10, increment: 0.1 }, { precision: 2, min: 10, max: 20, increment: 0.5 }, ], }; const consentManagement = { gdpr: { cmpApi: "iab", timeout: 8000, allowAuctionWithoutConsent: false, defaultGdprScope: true, }, gpp: { cmpApi: "iab", timeout: 8e3, defaultGdprScope: true, allowAuctionWithoutConsent: true, }, usp: { cmpApi: "iab", timeout: 100, defaultGdprScope: true, allowAuctionWithoutConsent: true, }, }; pbjs.que.push(function () { pbjs.setConfig({ useBidCache: true, ttlBuffer: 6, timeoutBuffer: 1000, bidderTimeout: PREBID_TIMEOUT, debug: true, priceGranularity: customConfigObject, enableSendAllBids: false, targetingControls: { alwaysIncludeDeals: true }, enableTIDs: true, allowActivities: true, deviceAccess: true, cache: { url: 'https://prebid.adnxs.com/pbc/v1/cache', ignoreBidderCacheKey: true, }, userSync: true, schain: { config: { complete: 1, ver: '1.0', nodes: [ { asi: 'embi-media.com', sid: SELLER_ID, hp: 1 }, { asi: 'google.com', sid: GOOGLE_MANAGER_ID, hp: 1 } ], }, }, }); pbjs.setBidderConfig({ bidders: ["appnexus", "equativ", "teads", "rubicon", "onetag", "richaudience", "adagio"], config: { ortb2: { imp: { ext: { prebid: { floormin: 0.01, }, }, }, }, }, }); pbjs.bidderSettings = { standard: { storageAllowed: true, adserverTargeting: [ { key: "hb_bidder", val: function (bidResponse) { return bidResponse.bidderCode; }, }, { key: "hb_adid", val: function (bidResponse) { return bidResponse.adId; }, }, { key: "hb_pb", val: function (bidResponse) { return bidResponse.pbCg; }, }, { key: "hb_size", val: function (bidResponse) { return bidResponse.size; }, }, { key: "hb_source", val: function (bidResponse) { return bidResponse.source; }, }, { key: "hb_format", val: function (bidResponse) { return bidResponse.mediaType; }, }, ], }, }; pbjs.addAdUnits(adUnits); }); pbjs.que.push(function () { pbjs.requestBids({ timeout: PREBID_TIMEOUT, bidsBackHandler: () => { const bids = pbjs.getBidResponsesForAdUnitCode(adUnit0)?.bids || []; const hasValid = bids.some((b) => b.cpm >= 0.01); if (hasValid) { pbjs.setTargetingForGPTAsync([adUnit0]); googletag.pubads().refresh([adSlot0]); } else { console.warn("🟡 Sin bids válidos. Permitimos que GAM llene solo."); googletag.pubads().refresh([adSlot0]); } }, }); }); pbjs.que.push(function () { pbjs.requestBids({ timeout: PREBID_TIMEOUT, bidsBackHandler: () => { const bids = pbjs.getBidResponsesForAdUnitCode(adUnit1)?.bids || []; const hasValid = bids.some((b) => b.cpm >= 0.01); if (hasValid) { pbjs.setTargetingForGPTAsync([adUnit1]); googletag.pubads().refresh([adSlot1]); } else { console.warn("🟡 Sin bids válidos. Permitimos que GAM llene solo."); googletag.pubads().refresh([adSlot1]); } }, }); }); let adSlot0, adSlot1; googletag.cmd.push(function () { adSlot0 = googletag .defineSlot(slot0, adUnit0Sizes, adUnit0) .setForceSafeFrame(true) .addService(googletag.pubads()); adSlot1 = googletag .defineSlot(slot1, adUnit1Sizes, adUnit1) .setForceSafeFrame(true) .addService(googletag.pubads()); googletag.pubads().setCentering(true); googletag.enableServices(); googletag.display(adUnit0); googletag.display(adUnit1); }); setInterval(function () { refreshBid(adUnit0, adSlot0); refreshBid(adUnit1, adSlot1); }, REFRESH_TIMEOUT); function refreshBid(adUnitCode, slot) { pbjs.que.push(() => { pbjs.requestBids({ adUnitCodes: [adUnitCode], timeout: PREBID_TIMEOUT, bidsBackHandler: () => { const bids = pbjs.getBidResponsesForAdUnitCode(adUnitCode)?.bids || []; const hasValid = bids.some((b) => b.cpm >= 0.01); if (hasValid) { pbjs.setTargetingForGPTAsync([adUnitCode]); googletag.pubads().refresh([slot]); } else { console.warn(`🟡 Sin bids válidos. GAM llena solo: ${adUnitCode}`); googletag.pubads().refresh([slot]); } }, }); }); } function failsafeRefresh(adUnitCode, slot) { setTimeout(() => { const bids = pbjs.getBidResponsesForAdUnitCode(adUnitCode)?.bids || []; const hasValid = bids.some((b) => b.cpm >= 0.01); if (!pbjs.initAdserverSet && hasValid) { console.warn("⏰ FAILSAFE activado con bid válido"); pbjs.setTargetingForGPTAsync([adUnitCode]); googletag.pubads().refresh([slot]); } else if (!pbjs.initAdserverSet) { console.warn(`⏰ FAILSAFE: sin pujas válidas, dejando que GAM llene (${adUnitCode})`); googletag.pubads().refresh([slot]); } }, FAILSAFE_TIMEOUT); } failsafeRefresh(adUnit0, adSlot0); failsafeRefresh(adUnit1, adSlot1); //})();