diff --git a/TemplateParts/content-cta.php b/TemplateParts/content-cta.php
deleted file mode 100644
index a368744d..00000000
--- a/TemplateParts/content-cta.php
+++ /dev/null
@@ -1,29 +0,0 @@
-= 0.5) {
- const variant = getCTAVariantFromDOM();
- if (variant) {
- trackCTAImpression(variant);
- impressionTracked = true;
- }
- }
- });
- },
- {
- threshold: 0.5, // Visible al menos 50%
- rootMargin: '0px',
- }
- );
-
- observer.observe(ctaElement);
- debugLog('IntersectionObserver configurado para el CTA');
- }
-
- /**
- * Setup de tracking de clicks en botones CTA
- */
- function setupClickTracking() {
- const ctaButtons = document.querySelectorAll('.cta-button[data-cta-variant]');
-
- if (ctaButtons.length === 0) {
- debugLog('No se encontraron botones CTA para tracking');
- return;
- }
-
- debugLog('Configurando tracking para ' + ctaButtons.length + ' botón(es) CTA');
-
- ctaButtons.forEach(function (button) {
- button.addEventListener('click', function (e) {
- const variant = this.getAttribute('data-cta-variant');
- const buttonText = this.textContent.trim();
- const targetUrl = this.getAttribute('href');
-
- trackCTAClick(variant, buttonText, targetUrl);
-
- // Si el enlace es válido, permitir navegación normal
- // Si no, prevenir default (útil para enlaces # o modal triggers)
- if (!targetUrl || targetUrl === '#' || targetUrl === 'javascript:void(0)') {
- e.preventDefault();
- debugLog('Navegación prevenida (URL inválida o #)');
- }
- });
- });
-
- debugLog('Click tracking configurado exitosamente');
- }
-
- /**
- * Obtener variante desde cookie (si existe)
- * Esta función es útil para validar el comportamiento del A/B test
- */
- function getCTAVariantFromCookie() {
- const name = 'roicta_variant=';
- const decodedCookie = decodeURIComponent(document.cookie);
- const cookieArray = decodedCookie.split(';');
-
- for (let i = 0; i < cookieArray.length; i++) {
- let cookie = cookieArray[i].trim();
- if (cookie.indexOf(name) === 0) {
- return cookie.substring(name.length, cookie.length);
- }
- }
- return null;
- }
-
- /**
- * Validar que la variante mostrada coincida con la cookie
- */
- function validateVariantConsistency() {
- const domVariant = getCTAVariantFromDOM();
- const cookieVariant = getCTAVariantFromCookie();
-
- if (cookieVariant && domVariant && domVariant !== cookieVariant) {
- debugLog('⚠️ ADVERTENCIA: Inconsistencia de variante detectada!', {
- dom: domVariant,
- cookie: cookieVariant,
- });
- } else if (domVariant) {
- debugLog('✓ Variante consistente:', domVariant);
- }
- }
-
- /**
- * Agregar clase de animación al CTA (opcional)
- */
- function animateCTA() {
- const ctaElement = document.querySelector('.cta-section');
- if (ctaElement) {
- ctaElement.classList.add('fade-in-up');
- }
- }
-
- /**
- * Inicialización principal
- */
- function init() {
- debugLog('Inicializando CTA A/B Testing Tracking', config);
-
- // Validar consistencia de variantes
- validateVariantConsistency();
-
- // Setup tracking de impresiones
- setupImpressionTracking();
-
- // Setup tracking de clicks
- setupClickTracking();
-
- // Animar CTA (opcional)
- animateCTA();
-
- debugLog('CTA A/B Testing Tracking inicializado correctamente');
- }
-
- /**
- * Esperar a que el DOM esté listo
- */
- if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', init);
- } else {
- // DOM ya está listo
- init();
- }
-
- /**
- * API pública (opcional, para debugging o extensiones)
- */
- window.roiTATracking = {
- trackClick: trackCTAClick,
- trackImpression: trackCTAImpression,
- getVariant: getCTAVariantFromDOM,
- config: config,
- };
-
- debugLog('API pública expuesta en window.roiTATracking');
-})();
diff --git a/functions-addon.php b/functions-addon.php
index f1700126..856fd424 100644
--- a/functions-addon.php
+++ b/functions-addon.php
@@ -204,22 +204,6 @@ function roi_render_component(string $componentName): string {
}
}
-// =============================================================================
-// CARGAR ARCHIVOS DE INC/
-// =============================================================================
-
-// CTA A/B Testing System
-$cta_ab_testing = get_template_directory() . '/Inc/cta-ab-testing.php';
-if (file_exists($cta_ab_testing)) {
- require_once $cta_ab_testing;
-}
-
-// CTA Customizer Settings
-$cta_customizer = get_template_directory() . '/Inc/customizer-cta.php';
-if (file_exists($cta_customizer)) {
- require_once $cta_customizer;
-}
-
// =============================================================================
// ESTILOS BASE PARA TOP NOTIFICATION BAR
// =============================================================================
diff --git a/functions.php b/functions.php
index c65fab57..cd91bb94 100644
--- a/functions.php
+++ b/functions.php
@@ -55,8 +55,6 @@ require_once get_template_directory() . '/Inc/apu-tables.php';
require_once get_template_directory() . '/Inc/search-disable.php';
require_once get_template_directory() . '/Inc/comments-disable.php';
require_once get_template_directory() . '/Inc/social-share.php';
-require_once get_template_directory() . '/Inc/cta-ab-testing.php';
-require_once get_template_directory() . '/Inc/customizer-cta.php';
// =============================================================================
// 3. INICIALIZAR DI CONTAINER (Clean Architecture)
diff --git a/inc/cta-ab-testing.php b/inc/cta-ab-testing.php
deleted file mode 100644
index d45698ba..00000000
--- a/inc/cta-ab-testing.php
+++ /dev/null
@@ -1,213 +0,0 @@
-
- *
- * @param array $args Argumentos opcionales para personalizar el CTA
- * @return void
- */
-function roi_display_cta($args = array()) {
- // Verificar si el CTA está habilitado
- $enable_cta = get_theme_mod('roi_enable_cta', true);
- if (!$enable_cta) {
- return;
- }
-
- // Solo mostrar en posts individuales por defecto
- $show_on = isset($args['show_on']) ? $args['show_on'] : 'single';
-
- if ($show_on === 'single' && !is_single()) {
- return;
- }
-
- // Obtener la variante del usuario
- $variant = roi_get_cta_variant();
-
- // Obtener configuración desde el Customizer
- $cta_config = roi_get_cta_config($variant);
-
- // Renderizar el CTA
- roi_render_cta($variant, $cta_config);
-}
-
-/**
- * Obtener configuración del CTA desde el Customizer
- *
- * @param string $variant 'A' o 'B'
- * @return array Configuración del CTA
- */
-function roi_get_cta_config($variant) {
- if ($variant === 'A') {
- return array(
- 'title' => get_theme_mod('roi_cta_a_title', __('Accede a 200,000+ Análisis de Precios Unitarios', 'roi-theme')),
- 'text' => get_theme_mod('roi_cta_a_text', __('Consulta estructuras completas, insumos y dosificaciones de los APUs más utilizados en construcción en México.', 'roi-theme')),
- 'button_text' => get_theme_mod('roi_cta_a_button', __('Ver Catálogo Completo', 'roi-theme')),
- 'button_url' => get_theme_mod('roi_cta_a_url', home_url('/catalogo')),
- 'variant' => 'A',
- );
- } else {
- return array(
- 'title' => get_theme_mod('roi_cta_b_title', __('¿Necesitas Consultar Más APUs?', 'roi-theme')),
- 'text' => get_theme_mod('roi_cta_b_text', __('Accede a nuestra biblioteca de 200,000 análisis de precios unitarios con estructuras detalladas y listados de insumos.', 'roi-theme')),
- 'button_text' => get_theme_mod('roi_cta_b_button', __('Conocer Planes de Membresía', 'roi-theme')),
- 'button_url' => get_theme_mod('roi_cta_b_url', home_url('/planes')),
- 'variant' => 'B',
- );
- }
-}
-
-/**
- * Renderizar el HTML del CTA
- *
- * @param string $variant 'A' o 'B'
- * @param array $config Configuración del CTA
- * @return void
- */
-function roi_render_cta($variant, $config) {
- ?>
-
-
- $variant,
- 'ga_enabled' => !empty(get_theme_mod('roi_ga_tracking_id', '')),
- 'ga_id' => get_theme_mod('roi_ga_tracking_id', ''),
- 'debug_mode' => defined('WP_DEBUG') && WP_DEBUG,
- );
-
- wp_localize_script('roicta-tracking', 'rroiA', $cta_data);
-}
-add_action('wp_enqueue_scripts', 'roi_cta_localize_script', 20);
diff --git a/inc/customizer-cta.php b/inc/customizer-cta.php
deleted file mode 100644
index bc37718f..00000000
--- a/inc/customizer-cta.php
+++ /dev/null
@@ -1,257 +0,0 @@
-add_section('roi_cta', array(
- 'title' => __('CTA A/B Testing', 'roi-theme'),
- 'description' => __('Configura las dos variantes del Call-to-Action que se mostrarán aleatoriamente. El sistema asignará automáticamente una variante a cada usuario (50/50).', 'roi-theme'),
- 'priority' => 132,
- ));
-
- // =====================================================
- // CONFIGURACIÓN GENERAL
- // =====================================================
-
- // Habilitar/Deshabilitar CTA
- $wp_customize->add_setting('roi_enable_cta', array(
- 'default' => true,
- 'sanitize_callback' => 'roi_sanitize_checkbox',
- 'transport' => 'refresh',
- ));
- $wp_customize->add_control('roi_enable_cta', array(
- 'label' => __('Habilitar CTA con A/B Testing', 'roi-theme'),
- 'description' => __('Muestra un Call-to-Action en los posts individuales con dos variantes aleatorias.', 'roi-theme'),
- 'section' => 'roi_cta',
- 'type' => 'checkbox',
- ));
-
- // Auto-insertar CTA (opcional, por defecto usar template tag)
- $wp_customize->add_setting('roi_cta_auto_insert', array(
- 'default' => false,
- 'sanitize_callback' => 'roi_sanitize_checkbox',
- 'transport' => 'refresh',
- ));
- $wp_customize->add_control('roi_cta_auto_insert', array(
- 'label' => __('Auto-insertar CTA después del contenido', 'roi-theme'),
- 'description' => __('Si está desactivado, usa el template tag roi_display_cta() manualmente.', 'roi-theme'),
- 'section' => 'roi_cta',
- 'type' => 'checkbox',
- ));
-
- // =====================================================
- // VARIANTE A - ENFOQUE EN CATÁLOGO
- // =====================================================
-
- // Separador visual
- $wp_customize->add_setting('roi_cta_a_separator', array(
- 'sanitize_callback' => 'sanitize_text_field',
- ));
- $wp_customize->add_control(new WP_Customize_Control(
- $wp_customize,
- 'roi_cta_a_separator',
- array(
- 'label' => __('━━━ Variante A: Catálogo ━━━', 'roi-theme'),
- 'description' => __('Enfoque en acceso al catálogo de 200,000+ APUs', 'roi-theme'),
- 'section' => 'roi_cta',
- 'type' => 'hidden',
- )
- ));
-
- // Título Variante A
- $wp_customize->add_setting('roi_cta_a_title', array(
- 'default' => __('Accede a 200,000+ Análisis de Precios Unitarios', 'roi-theme'),
- 'sanitize_callback' => 'sanitize_text_field',
- 'transport' => 'postMessage',
- ));
- $wp_customize->add_control('roi_cta_a_title', array(
- 'label' => __('Título', 'roi-theme'),
- 'section' => 'roi_cta',
- 'type' => 'text',
- ));
-
- // Texto Variante A
- $wp_customize->add_setting('roi_cta_a_text', array(
- 'default' => __('Consulta estructuras completas, insumos y dosificaciones de los APUs más utilizados en construcción en México.', 'roi-theme'),
- 'sanitize_callback' => 'sanitize_textarea_field',
- 'transport' => 'postMessage',
- ));
- $wp_customize->add_control('roi_cta_a_text', array(
- 'label' => __('Texto descriptivo', 'roi-theme'),
- 'section' => 'roi_cta',
- 'type' => 'textarea',
- ));
-
- // Botón Variante A
- $wp_customize->add_setting('roi_cta_a_button', array(
- 'default' => __('Ver Catálogo Completo', 'roi-theme'),
- 'sanitize_callback' => 'sanitize_text_field',
- 'transport' => 'postMessage',
- ));
- $wp_customize->add_control('roi_cta_a_button', array(
- 'label' => __('Texto del botón', 'roi-theme'),
- 'section' => 'roi_cta',
- 'type' => 'text',
- ));
-
- // URL Variante A
- $wp_customize->add_setting('roi_cta_a_url', array(
- 'default' => '#',
- 'sanitize_callback' => 'esc_url_raw',
- 'transport' => 'postMessage',
- ));
- $wp_customize->add_control('roi_cta_a_url', array(
- 'label' => __('URL del botón', 'roi-theme'),
- 'description' => __('Ejemplo: /catalogo-completo/ o una URL completa', 'roi-theme'),
- 'section' => 'roi_cta',
- 'type' => 'url',
- ));
-
- // =====================================================
- // VARIANTE B - ENFOQUE EN MEMBRESÍA
- // =====================================================
-
- // Separador visual
- $wp_customize->add_setting('roi_cta_b_separator', array(
- 'sanitize_callback' => 'sanitize_text_field',
- ));
- $wp_customize->add_control(new WP_Customize_Control(
- $wp_customize,
- 'roi_cta_b_separator',
- array(
- 'label' => __('━━━ Variante B: Membresía ━━━', 'roi-theme'),
- 'description' => __('Enfoque en planes de membresía y acceso premium', 'roi-theme'),
- 'section' => 'roi_cta',
- 'type' => 'hidden',
- )
- ));
-
- // Título Variante B
- $wp_customize->add_setting('roi_cta_b_title', array(
- 'default' => __('¿Necesitas Consultar Más APUs?', 'roi-theme'),
- 'sanitize_callback' => 'sanitize_text_field',
- 'transport' => 'postMessage',
- ));
- $wp_customize->add_control('roi_cta_b_title', array(
- 'label' => __('Título', 'roi-theme'),
- 'section' => 'roi_cta',
- 'type' => 'text',
- ));
-
- // Texto Variante B
- $wp_customize->add_setting('roi_cta_b_text', array(
- 'default' => __('Accede a nuestra biblioteca de 200,000 análisis de precios unitarios con estructuras detalladas y listados de insumos.', 'roi-theme'),
- 'sanitize_callback' => 'sanitize_textarea_field',
- 'transport' => 'postMessage',
- ));
- $wp_customize->add_control('roi_cta_b_text', array(
- 'label' => __('Texto descriptivo', 'roi-theme'),
- 'section' => 'roi_cta',
- 'type' => 'textarea',
- ));
-
- // Botón Variante B
- $wp_customize->add_setting('roi_cta_b_button', array(
- 'default' => __('Conocer Planes de Membresía', 'roi-theme'),
- 'sanitize_callback' => 'sanitize_text_field',
- 'transport' => 'postMessage',
- ));
- $wp_customize->add_control('roi_cta_b_button', array(
- 'label' => __('Texto del botón', 'roi-theme'),
- 'section' => 'roi_cta',
- 'type' => 'text',
- ));
-
- // URL Variante B
- $wp_customize->add_setting('roi_cta_b_url', array(
- 'default' => '#',
- 'sanitize_callback' => 'esc_url_raw',
- 'transport' => 'postMessage',
- ));
- $wp_customize->add_control('roi_cta_b_url', array(
- 'label' => __('URL del botón', 'roi-theme'),
- 'description' => __('Ejemplo: /planes-de-membresia/ o una URL completa', 'roi-theme'),
- 'section' => 'roi_cta',
- 'type' => 'url',
- ));
-
- // =====================================================
- // GOOGLE ANALYTICS TRACKING
- // =====================================================
-
- // Separador visual
- $wp_customize->add_setting('roi_cta_ga_separator', array(
- 'sanitize_callback' => 'sanitize_text_field',
- ));
- $wp_customize->add_control(new WP_Customize_Control(
- $wp_customize,
- 'roi_cta_ga_separator',
- array(
- 'label' => __('━━━ Google Analytics ━━━', 'roi-theme'),
- 'description' => __('Configuración para tracking de conversiones', 'roi-theme'),
- 'section' => 'roi_cta',
- 'type' => 'hidden',
- )
- ));
-
- // Google Analytics Tracking ID
- $wp_customize->add_setting('roi_ga_tracking_id', array(
- 'default' => '',
- 'sanitize_callback' => 'sanitize_text_field',
- 'transport' => 'refresh',
- ));
- $wp_customize->add_control('roi_ga_tracking_id', array(
- 'label' => __('Google Analytics Tracking ID', 'roi-theme'),
- 'description' => __('Formato: G-XXXXXXXXXX (GA4) o UA-XXXXXXXXX-X (Universal Analytics). Déjalo vacío si ya tienes GA instalado mediante plugin.', 'roi-theme'),
- 'section' => 'roi_cta',
- 'type' => 'text',
- ));
-}
-add_action('customize_register', 'roi_customize_cta');
-
-/**
- * Agregar script de Google Analytics en el header si está configurado
- */
-function roi_output_google_analytics() {
- $tracking_id = get_theme_mod('roi_ga_tracking_id', '');
-
- // No mostrar si está vacío o si estamos en el admin
- if (empty($tracking_id) || is_admin()) {
- return;
- }
-
- // No mostrar si es un usuario admin logueado
- if (current_user_can('manage_options')) {
- return;
- }
- ?>
-
-
-
- true,
- 'strategy' => 'defer',
- )
- );
-}
-
-add_action('wp_enqueue_scripts', 'roi_enqueue_cta_assets', 16);
-
/**
* Enqueue CTA Box Sidebar styles (Issue #36)
*