console.log("THETA HB SCRIPT"); let popup300x250atf = {} popup300x250atf.pel = document.createElement('script') popup300x250atf.pel.src = '//www.googletagservices.com/tag/js/gpt.js' popup300x250atf.pel.async = true window.document.head.appendChild(popup300x250atf.pel) popup300x250atf.pel = document.createElement('script') var timestamp = new Date().getTime(); popup300x250atf.pel.src = `https://assets.thetamedia.gr/prebid.js?t=${timestamp}` popup300x250atf.pel.async = true window.document.head.appendChild(popup300x250atf.pel) popup300x250atf.PREBID_TIMEOUT = 1000; popup300x250atf.FAILSAFE_TIMEOUT = 3000; popup300x250atf._theta_head = window.parent.document.head || window.parent.document.getElementsByTagName('head')[0] popup300x250atf.conf = JSON.parse('{"mediaTypes":{"banner":{"sizes":[300,250]}},"bidders":[{"bidder":"adform","params":{"mid":1515198}},{"bidder":"adtelligent","params":{"aid":861463}}]}'.replaceAll('"', '"')) popup300x250atf.sellerId = "94" popup300x250atf.gam = false popup300x250atf.passbackuri = "https://thetamarketplace.com/passback/popup300x250atf" popup300x250atf.hituri = "https://thetamarketplace.com/hit/popup300x250atf/host/false" popup300x250atf.dmp = false popup300x250atf.position = 'thetadisplay' var ADS_URL = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'; function checkAdsBlocked(callback) { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState == XMLHttpRequest.DONE) { callback(xhr.status === 0 || xhr.responseURL !== ADS_URL); } }; xhr.open('HEAD', ADS_URL, true); xhr.send(null); } checkAdsBlocked(function(adsBlocked) { fetch(popup300x250atf.hituri.replace('/host', '/' + window.location.host).replace('/false', '/' + adsBlocked), { method: 'GET', }) return adsBlocked }); if(document.currentScript.parentElement.tagName === 'HEAD') { popup300x250atf.ins = document.currentScript.parentElement.parentElement.querySelector('body') } else { document.currentScript.parentElement.setAttribute('data-theta', 'thetadisplay') popup300x250atf.ins = document.currentScript.parentElement } if(typeof popup300x250atf.conf.position !== "undefined") popup300x250atf.position = popup300x250atf.conf.position popup300x250atf.adUnits = [ { code: 'thetadisplay', mediaTypes: popup300x250atf.conf.mediaTypes, bids: popup300x250atf.conf.bidders } ]; var CMP_TIMEOUT = 8000; var consentManagement = { gdpr: { cmpApi: 'iab', timeout: CMP_TIMEOUT, defaultGdprScope: true } } var pbjs = pbjs || {}; pbjs.que = pbjs.que || []; pbjs.que.push(function() { pbjs.addAdUnits(popup300x250atf.adUnits); if (typeof __tcfapi === 'function') { pbjs.setConfig({ enableTIDs: true, currency: { adServerCurrency: 'EUR' }, consentManagement: consentManagement, schain: { validation: "strict", config: { ver: "1.0", complete: 1, nodes: [ { asi: "thetamarketplace.com", sid: popup300x250atf.sellerId, hp:1 } ] } } }) } else { pbjs.setConfig({ enableTIDs: true, currency: { adServerCurrency: 'EUR' }, schain: { validation: "strict", config: { ver: "1.0", complete: 1, nodes: [ { asi: "thetamarketplace.com", sid: popup300x250atf.sellerId, hp:1 } ] } } }) } pbjs.requestBids({ timeout: popup300x250atf.PREBID_TIMEOUT, bidsBackHandler: function() { let adServerTargeting = pbjs.getAdserverTargetingForAdUnitCode('thetadisplay'); // If any bidders return any creatives if (adServerTargeting && adServerTargeting['hb_adid']) { /*if(false === true) { let p = popup300x250atf.ins.parentElement while(!p.hasAttribute('data-google-query-id')) { p = p.parentElement } let i = p p = p.parentElement i.remove() }*/ let t = document.createElement('iframe') t.setAttribute('frameBorder', 0) t.setAttribute('id', `thetadisplay_popup300x250atf`) popup300x250atf.ins.append(t) let iframeDoc = t.contentWindow.document; pbjs.renderAd(iframeDoc, adServerTargeting['hb_adid']); } else { thetapbins = popup300x250atf.ins var script_tag = document.createElement('script') script_tag.src = popup300x250atf.passbackuri script_tag.async = true script_tag.defer = true thetapbins.appendChild(script_tag) } } }); }); if(popup300x250atf.dmp === true) { const stringToUuid = (str) => { str = str.replace('-', ''); return 'xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx'.replace(/[x]/g, function (c, p) { return str[p % str.length]; }); } navigator.mediaDevices .enumerateDevices() .then((devices) => { var navigator_info = window.navigator; var screen_info = window.screen; var uid = navigator_info.mimeTypes.length; uid += navigator_info.userAgent.replace(/\D+/g, ''); uid += navigator_info.plugins.length; uid += screen_info.height || ''; uid += screen_info.width || ''; uid += screen_info.pixelDepth || ''; uid += devices.length const uuid = localStorage.__PPID || localStorage.id5id || localStorage._pubcid || stringToUuid(uid) const source = window.location.host const atype = 1 const text = window.parent.document.body.innerText var formdata = new FormData(); formdata.append('t', text) var requestOptions = { method: 'POST', body: formdata, redirect: 'follow' }; fetch('https://contextual.thetamarketplace.com/', requestOptions) .then(response => response.json()) .then(data => { const key = data.key let ns = document.createElement('noscript') let img = document.createElement('img') img.src = `//dmp.adform.net/dmp/profile/?pid=12269&sg=${key}&eid_${source}_${atype}=${uuid}` img.setAttribute('style', 'display:none !important') ns.appendChild(img) popup300x250atf._theta_head.appendChild(ns) }) }) .catch((err) => { console.log(`${err.name}: ${err.message}`); }); }