diff --git a/wp-content/themes/apus-theme/assets/js/cta-tracking.js b/wp-content/themes/apus-theme/assets/js/cta-tracking.js index 3e823657..54019477 100644 --- a/wp-content/themes/apus-theme/assets/js/cta-tracking.js +++ b/wp-content/themes/apus-theme/assets/js/cta-tracking.js @@ -101,7 +101,7 @@ * Solo registra cuando el CTA es visible al menos el 50% */ function setupImpressionTracking() { - const ctaElement = document.querySelector('.apus-cta-wrapper'); + const ctaElement = document.querySelector('.cta-section'); if (!ctaElement) { debugLog('CTA no encontrado en el DOM'); @@ -216,7 +216,7 @@ * Agregar clase de animación al CTA (opcional) */ function animateCTA() { - const ctaElement = document.querySelector('.apus-cta-wrapper'); + const ctaElement = document.querySelector('.cta-section'); if (ctaElement) { ctaElement.classList.add('fade-in-up'); } diff --git a/wp-content/themes/apus-theme/assets/js/main.js b/wp-content/themes/apus-theme/assets/js/main.js index 3cf92c1c..f002d1a0 100644 --- a/wp-content/themes/apus-theme/assets/js/main.js +++ b/wp-content/themes/apus-theme/assets/js/main.js @@ -23,33 +23,12 @@ window.addEventListener('scroll', function() { * - localStorage state */ -// A/B Testing for CTA sections -document.addEventListener('DOMContentLoaded', function() { - const ctaVariant = Math.random() < 0.5 ? 'A' : 'B'; - - if (ctaVariant === 'A') { - const variantA = document.querySelector('.cta-variant-a'); - if (variantA) variantA.style.display = 'block'; - } else { - const variantB = document.querySelector('.cta-variant-b'); - if (variantB) variantB.style.display = 'block'; - } - - document.querySelectorAll('.cta-button').forEach(button => { - button.addEventListener('click', function() { - const variant = this.getAttribute('data-cta-variant'); - console.log('CTA clicked - Variant: ' + variant); - - if (typeof gtag !== 'undefined') { - gtag('event', 'cta_click', { - 'event_category': 'CTA', - 'event_label': 'Variant_' + variant, - 'value': variant - }); - } - }); - }); -}); +/** + * CTA A/B Testing + * Handled by cta-ab-testing.php (PHP) and cta-tracking.js + * - PHP renders only ONE variant based on cookie + * - cta-tracking.js handles Analytics tracking + */ // Contact Modal - Dynamic Loading function loadContactModal() { diff --git a/wp-content/themes/apus-theme/inc/cta-ab-testing.php b/wp-content/themes/apus-theme/inc/cta-ab-testing.php index fdcfa917..e9f22b53 100644 --- a/wp-content/themes/apus-theme/inc/cta-ab-testing.php +++ b/wp-content/themes/apus-theme/inc/cta-ab-testing.php @@ -89,7 +89,7 @@ function apus_get_cta_config($variant) { 'title' => get_theme_mod('apus_cta_a_title', __('Accede a 200,000+ Análisis de Precios Unitarios', 'apus-theme')), 'text' => get_theme_mod('apus_cta_a_text', __('Consulta estructuras completas, insumos y dosificaciones de los APUs más utilizados en construcción en México.', 'apus-theme')), 'button_text' => get_theme_mod('apus_cta_a_button', __('Ver Catálogo Completo', 'apus-theme')), - 'button_url' => get_theme_mod('apus_cta_a_url', '#'), + 'button_url' => get_theme_mod('apus_cta_a_url', home_url('/catalogo')), 'variant' => 'A', ); } else { @@ -97,7 +97,7 @@ function apus_get_cta_config($variant) { 'title' => get_theme_mod('apus_cta_b_title', __('¿Necesitas Consultar Más APUs?', 'apus-theme')), 'text' => get_theme_mod('apus_cta_b_text', __('Accede a nuestra biblioteca de 200,000 análisis de precios unitarios con estructuras detalladas y listados de insumos.', 'apus-theme')), 'button_text' => get_theme_mod('apus_cta_b_button', __('Conocer Planes de Membresía', 'apus-theme')), - 'button_url' => get_theme_mod('apus_cta_b_url', '#'), + 'button_url' => get_theme_mod('apus_cta_b_url', home_url('/planes')), 'variant' => 'B', ); } @@ -112,9 +112,9 @@ function apus_get_cta_config($variant) { */ function apus_render_cta($variant, $config) { ?> - -
+ +

@@ -127,8 +127,7 @@ function apus_render_cta($variant, $config) {
+ data-cta-variant=""> diff --git a/wp-content/themes/apus-theme/single.php b/wp-content/themes/apus-theme/single.php index d48a80d9..05373752 100644 --- a/wp-content/themes/apus-theme/single.php +++ b/wp-content/themes/apus-theme/single.php @@ -115,36 +115,8 @@ get_header();

- - - - - - + +