/* [IGJ Tracking] 2026-11-29T16:02:19.977Z */ console.log('[IGJ Tracking] script loaded'); window.dataLayer = window.dataLayer || [];(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);console.log('[GTM] loading GTM-PTT9CN2W');})(window,document,'script','dataLayer','GTM-PTT9CN2W'); /* custom_head_scripts */ (function(){var s=document.createElement('script');s.src="https://www.googletagmanager.com/gtag/js?id=AW-978230397";s.async=true;document.head.appendChild(s);})(); (function() { var META_PIXEL_ID = '2172063469594437'; // Evitar duplicar Pixel si ya existe if (!window.fbq) { !function(f,b,e,v,n,t,s) { if(f.fbq)return; n=f.fbq=function(){n.callMethod ? n.callMethod.apply(n,arguments) : n.queue.push(arguments)}; if(!f._fbq)f._fbq=n; n.push=n; n.loaded=!0; n.version='2.0'; n.queue=[]; t=b.createElement(e); t.async=!0; t.src=v; s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s); }(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', META_PIXEL_ID); fbq('track', 'PageView'); } function trackEvent(eventName, params) { if (typeof fbq === 'function') { fbq('track', eventName, params || {}); console.log('[Meta Pixel]', eventName, params || {}); } } function getPageTitle() { return document.title || window.location.pathname; } function getPageCategory() { var path = window.location.pathname.toLowerCase(); if (path.includes('acuerdo-286')) return 'Acuerdo 286'; if (path.includes('licenciatura')) return 'Licenciatura'; if (path.includes('bachillerato')) return 'Bachillerato'; if (path.includes('curso')) return 'Curso'; if (path.includes('admision') || path.includes('admisiones')) return 'Admisiones'; if (path.includes('blog')) return 'Blog'; if (path.includes('contacto')) return 'Contacto'; return 'Página general'; } document.addEventListener('DOMContentLoaded', function() { /* ================================================== ViewContent ================================================== */ var importantPaths = [ 'acuerdo-286', 'licenciatura', 'bachillerato', 'curso', 'programa', 'admision', 'admisiones', 'blog', 'contacto' ]; var currentPath = window.location.pathname.toLowerCase(); if (importantPaths.some(function(path) { return currentPath.includes(path); })) { trackEvent('ViewContent', { content_name: getPageTitle(), content_category: getPageCategory(), content_type: 'page' }); } /* ================================================== Contact: WhatsApp, teléfono, email ================================================== */ document.body.addEventListener('click', function(e) { var link = e.target.closest('a, button'); if (!link) return; var href = link.getAttribute('href') || ''; var text = (link.innerText || '').toLowerCase(); if (href.includes('wa.me') || href.includes('whatsapp') || text.includes('whatsapp')) { trackEvent('Contact', { contact_method: 'whatsapp', location: 'site' }); } if (href.startsWith('tel:')) { trackEvent('Contact', { contact_method: 'phone', location: 'site' }); } if (href.startsWith('mailto:')) { trackEvent('Contact', { contact_method: 'email', location: 'site' }); } if ( text.includes('hablar con asesor') || text.includes('solicita información') || text.includes('solicitar información') || text.includes('contáctanos') || text.includes('contactar') || text.includes('agenda') || text.includes('inscríbete') || text.includes('registrarme') ) { trackEvent('Contact', { contact_method: 'cta', location: 'site' }); } }); /* ================================================== Search ================================================== */ document.body.addEventListener('submit', function(e) { var form = e.target; var searchInput = form.querySelector('input[type="search"], input[name*="search"], input[name*="buscar"], input[placeholder*="buscar"], input[placeholder*="Buscar"]'); if (searchInput && searchInput.value.trim().length >= 2) { trackEvent('Search', { search_string: searchInput.value.trim() }); } }); /* ================================================== Lead, SubmitApplication, CompleteRegistration ================================================== Detecta formularios enviados. Nota: este método dispara al submit. Si el sitio usa AJAX, lo ideal es mover estos eventos al callback de éxito del formulario. ================================================== */ document.body.addEventListener('submit', function(e) { var form = e.target; var formText = ( (form.getAttribute('id') || '') + ' ' + (form.getAttribute('class') || '') + ' ' + (form.getAttribute('name') || '') + ' ' + window.location.pathname ).toLowerCase(); if (form.dataset.metaTracked === 'true') return; form.dataset.metaTracked = 'true'; setTimeout(function() { trackEvent('Lead', { content_name: getPageTitle(), status: 'submitted' }); if ( formText.includes('registro') || formText.includes('admission') || formText.includes('admision') || formText.includes('admisiones') ) { trackEvent('CompleteRegistration', { registration_method: 'website' }); } if ( formText.includes('acuerdo') || formText.includes('286') || formText.includes('solicitud') || formText.includes('registro') || formText.includes('admision') || formText.includes('admisiones') ) { trackEvent('SubmitApplication', { application_type: 'educational_program' }); } }, 800); }); }); })(); window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'AW-978230397'); document.addEventListener('DOMContentLoaded',function(){ function loadScript(a){var b=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript",c.src="https://tracker.metricool.com/resources/be.js",c.onreadystatechange=a,c.onload=a,b.appendChild(c)}loadScript(function(){beTracker.t({hash:"4b7428c81dd914a88d977fa91dd9bd5c"})}); }); var _igvc=['/acuerdo','/licenciatura','/bachillerato','/maestria','/curso','/programa','/admisiones','/blog','/contacto','/oferta'];var _igpp=history.pushState,_igpr=history.replaceState;function _ignav(){var np=window.location.pathname.toLowerCase();if(window.fbq){fbq('track','PageView');}if(typeof window._metaViewContent==='function'){setTimeout(window._metaViewContent,300);}if(window.gtag){window.gtag('event','page_view',{page_path:np});}}history.pushState=function(){_igpp.apply(this,arguments);setTimeout(_ignav,200);};history.replaceState=function(){_igpr.apply(this,arguments);setTimeout(_ignav,200);};window.addEventListener('popstate',function(){setTimeout(_ignav,200);});