Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
- Base: wintercms/winter branch 1.2 (full framework) - Theme vivespos: Canvas 7 + Bootstrap 5 CDN, custom CSS - Layout: deferred GTM/GA4 tracking, JSON-LD SoftwareApplication - Partials: hero (offline-first), features, modes (offline/nube toggle), screenshots, pricing (3 planes), comparison, FAQ, CTA - Plugin VivesPOS.Site with ContactForm - Dockerfile: PHP 8.2 Apache, port 80, healthcheck - Added winter/wn-pages, blog, sitemap, seo plugins - Active theme set to vivespos
53 lines
1.5 KiB
HTML
53 lines
1.5 KiB
HTML
description = "GTM + GA4 diferido post-load (PageSpeed optimizado)"
|
|
==
|
|
<script>
|
|
(function () {
|
|
var loaded = false;
|
|
function loadTracking() {
|
|
if (loaded) return;
|
|
loaded = true;
|
|
|
|
// Google Tag Manager
|
|
(function (w, d, s, l, i) {
|
|
w[l] = w[l] || [];
|
|
w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
|
|
var f = d.getElementsByTagName(s)[0],
|
|
j = d.createElement(s),
|
|
dl = l != 'dataLayer' ? '&l=' + l : '';
|
|
j.async = true;
|
|
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
|
|
f.parentNode.insertBefore(j, f);
|
|
})(window, document, 'script', 'dataLayer', 'GTM-P9B758T');
|
|
|
|
// GA4
|
|
var g = document.createElement('script');
|
|
g.async = true;
|
|
g.src = 'https://www.googletagmanager.com/gtag/js?id=G-V6SX1D3XVE';
|
|
document.head.appendChild(g);
|
|
window.dataLayer = window.dataLayer || [];
|
|
function gtag() { dataLayer.push(arguments); }
|
|
window.gtag = gtag;
|
|
gtag('js', new Date());
|
|
gtag('config', 'G-V6SX1D3XVE');
|
|
}
|
|
|
|
function schedule() {
|
|
if ('requestIdleCallback' in window) {
|
|
requestIdleCallback(function () { loadTracking(); }, { timeout: 3500 });
|
|
} else {
|
|
setTimeout(loadTracking, 2500);
|
|
}
|
|
}
|
|
|
|
['pointerdown', 'keydown', 'scroll', 'touchstart'].forEach(function (ev) {
|
|
window.addEventListener(ev, function () { loadTracking(); }, { once: true, passive: true });
|
|
});
|
|
|
|
if (document.readyState === 'complete') {
|
|
schedule();
|
|
} else {
|
|
window.addEventListener('load', schedule);
|
|
}
|
|
})();
|
|
</script>
|