Emergency departments at regional hospitals are under immense pressure, despite more specialist doctors working in the regions.
" } googletag.pubads().enableLazyLoad({ fetchMarginPercent: 150, renderMarginPercent: 100, mobileScaling: 2.0 }); googletag.pubads().enableSingleRequest(); googletag.pubads().collapseEmptyDivs(); // --- ACTIVE VIEW REFRESH LOGIC --- var refreshTimers = {}; // Stores the timers for each ad // Set up the "motion sensor" to watch the ads var viewabilityObserver = new IntersectionObserver(function(entries) { entries.forEach(function(entry) { var divId = entry.target.id; var slotToRefresh = adSlots[divId]; if (entry.isIntersecting) { // The ad is at least 50% visible on screen. Start the 30-second clock! refreshTimers[divId] = setInterval(function() { if (slotToRefresh) { googletag.pubads().refresh([slotToRefresh]); } }, 30000); } else { // The user scrolled away. Pause/clear the clock to protect viewability. clearInterval(refreshTimers[divId]); } }); }, { threshold: 0.5 // Trigger when exactly 50% of the ad is visible (Google's Active View standard) }); // Wait for Google to actually render an ad, THEN tell the observer to start watching it googletag.pubads().addEventListener('slotRenderEnded', function(event) { if (!event.isEmpty) { var renderedDivId = event.slot.getSlotElementId(); var adElement = document.getElementById(renderedDivId); if (adElement) { viewabilityObserver.observe(adElement); } } }); // Enable Services googletag.enableServices(); });
Emergency departments at regional hospitals are under immense pressure, despite more specialist doctors working in the regions.