with a real script tag after load.
window.addEventListener('load', () => {
// Defer analytics/chat/etc by 1 second to avoid competing with page interactivity
setTimeout(() => {
$$('script[data-late-src]').forEach(s => {
const n = document.createElement('script');
n.src = s.dataset.lateSrc;
n.async = true;
// copy attributes like data-* if needed
for (const { name, value } of Array.from(s.attributes)) {
if (name.startsWith('data-') && name !== 'data-late-src') n.setAttribute(name, value);
}
s.replaceWith(n);
});
}, 1000);
});
/*** 7) Mark big page sections as virtual for cheap initial paint **********/
// Mark GlobalBazaar's main sections for content-visibility optimization
$$('main, section, .container, .content').forEach(el => {
if (!el.hasAttribute('data-virtual-section')) el.setAttribute('data-virtual-section', '');
});
})();