var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; var adthrive = adthrive || {}; adthrive.cmd = adthrive.cmd || []; adthrive.cmd.push(function() { googletag.cmd.push(function () { var targetSlot = '/1003244/GPT-Billboard'; googletag.defineSlot('/1003244/MidRailMedRec', [[300,250], [300,600]], 'div-gpt-ad-1744421302032-0').addService(googletag.pubads()); googletag.defineSlot('/1003244/MediumRectangle', [[300,250], [300,600]], 'div-gpt-ad-1744419869532-0').addService(googletag.pubads()); googletag.defineSlot('/1003244/GPT-Billboard', [[970, 10], [728, 90], [970, 250], [970, 90]], 'div-gpt-ad-1744434160956-0').addService(googletag.pubads()); googletag.pubads().addEventListener('impressionViewable', function(event) { var slot = event.slot; if(event.slot.getAdUnitPath() === targetSlot) { setTimeout(function() { var slotWrapper = document.getElementById(event.slot.getSlotElementId()).parentNode; slotWrapper.removeEventListener('scroll', scrollBillboard, false); slotWrapper.classList.add('ad-top-billboard-rendered'); slotWrapper.classList.remove('ad-top-billboard-init'); slotWrapper.removeAttribute('style'); }, 100); } }); (function() { var config = { 'GPT-Billboard': { max: 3, interval: 75000 }, 'MediumRectangle': { max: 6, interval: 45000 }, 'MidRailMedRec': { max: 6, interval: 45000 }, 'Default': { max: 6, interval: 45000 } }; window.refreshCounters = window.refreshCounters || {}; window.lastRefreshTime = window.lastRefreshTime || {}; console.log('[AdRefresh] Prod monitor active (5s polling).'); var refreshInterval = setInterval(function() { if (typeof googletag === 'undefined' || !googletag.apiReady) return; var allSlots = googletag.pubads().getSlots(); var now = Date.now(); var activeRemaining = false; allSlots.forEach(function(slot) { var elementId = slot.getSlotElementId(); if (elementId.startsWith('AdThrive_')) return; var path = slot.getAdUnitPath(); var type = 'Default'; if (path.includes('GPT-Billboard')) type = 'GPT-Billboard'; else if (path.includes('MediumRectangle')) type = 'MediumRectangle'; else if (path.includes('MidRailMedRec')) type = 'MidRailMedRec'; var cfg = config[type]; if (typeof window.refreshCounters[elementId] === 'undefined') { window.refreshCounters[elementId] = 0; window.lastRefreshTime[elementId] = now; } if (window.refreshCounters[elementId] < cfg.max) { activeRemaining = true; // Added 1000ms of slack to account for execution fluctuations if ((now - window.lastRefreshTime[elementId]) >= (cfg.interval - 1000)) { var actualElapsed = Math.round((now - window.lastRefreshTime[elementId]) / 1000); window.refreshCounters[elementId]++; window.lastRefreshTime[elementId] = now; // Compact production log entry console.log(`[AdRefresh] Fired: ${elementId} (${type}) | Count: ${window.refreshCounters[elementId]}/${cfg.max} | Elapsed: ${actualElapsed}s`); googletag.pubads().refresh([slot]); } } }); if (!activeRemaining) { clearInterval(refreshInterval); console.log('[AdRefresh] All limits reached. Loop cleared.'); } }, 5000); // Polling every 5 seconds keeps targets perfectly accurate })(); }); });