window.googletag = window.googletag || {cmd: []}; var priceRules = {}; var urlParams = new URLSearchParams(window.location.search); var src = urlParams.get('src'); function listenAdClicks() { let isAdsArea = false; let ad_link = ''; function detectAdsArea(e) { const iframe = e.target.closest('iframe'); if (iframe) { isAdsArea = true; ad_link = iframe.getAttribute('src'); } else { isAdsArea = false; ad_link = ''; } } document.addEventListener('mouseover', detectAdsArea); document.addEventListener('touchmove', detectAdsArea, { passive: true }); window.addEventListener('blur', function () { if(isAdsArea) { fbq('track', 'ViewContent'); } }); } googletag.cmd.push(function() { googletag.pubads().addEventListener('slotVisibilityChanged', function(event) { const visibility = event.inViewPercentage; if (visibility > 0) { listenAdClicks(); } }); }); googletag.cmd.push(function() { googletag.pubads().addEventListener('slotVisibilityChanged', function(event) { const slotPath = event.slot.getAdUnitPath(); const visibility = event.inViewPercentage; if (slotPath.includes('interstitial') && visibility >= 1) { fbq('track', 'ViewContent'); } }); }); function startContent1Script() { try { var priceRule = 4; if (priceRules['mobdia.com_Web_Content_1_4548239']) { if (priceRules['mobdia.com_Web_Content_1_4548239'][src]) { priceRule = priceRules['mobdia.com_Web_Content_1_4548239'][src]; } } let adSlot; googletag.cmd.push(function() { adSlot = googletag.defineSlot('/22013536576/mobdia.com/mobdia.com_web_content_1_4548239', [[336, 280], [300, 250], [250, 250], 'fluid'], 'div-gpt-ad-1715818371803-0'); adSlot.setTargeting("floor_price", [`r_${priceRule}`]); adSlot.addService(googletag.pubads()); googletag.enableServices(); googletag.display('div-gpt-ad-1715818371803-0'); }); } catch (error) { console.error('Error in startContent1Script:', error); } } startContent1Script(); function startTopAnchorScript() { try { var priceRule = 4; if (priceRules['mobdia.com_Top_Anchor_264323']) { if (priceRules['mobdia.com_Top_Anchor_264323'][src]) { priceRule = priceRules['mobdia.com_Top_Anchor_264323'][src]; } } let anchorSlot; googletag.cmd.push(function() { anchorSlot = googletag.defineOutOfPageSlot('/22013536576/mobdia.com/mobdia.com_top_anchor_264323', googletag.enums.OutOfPageFormat.TOP_ANCHOR); anchorSlot.setTargeting("floor_price", [`r_${priceRule}`]); anchorSlot.addService(googletag.pubads()); googletag.enableServices(); googletag.display(anchorSlot.getSlotElementId()); }); } catch (error) { console.error('Error in startTopAnchorScript:', error); } } startTopAnchorScript(); function startMFixedScript() { try { var priceRule = 4; if (priceRules['mobdia.com_m_Fixed_954896']) { if (priceRules['mobdia.com_m_Fixed_954896'][src]) { priceRule = priceRules['mobdia.com_m_Fixed_954896'][src]; } } let mfixedSlot; googletag.cmd.push(function() { mfixedSlot = googletag.defineSlot('/22013536576/mobdia.com/mobdia.com_m_fixed_954896', [[300, 50], [320, 50]], 'div-gpt-ad-1686178920381-0'); mfixedSlot.setTargeting("floor_price", [`r_${priceRule}`]); mfixedSlot.addService(googletag.pubads()); googletag.enableServices(); googletag.display(mfixedSlot.getSlotElementId()); }); } catch (error) { console.error('Error in startMFixedScript:', error); } } setTimeout(startMFixedScript, 150);