HISTORIAS DE EVENTOS REALES

/** * SCRIPT DE TRAZABILIDAD WHATSAPP v5.0 (EMOJIS SIMPLES) * Creado: 31 de julio de 2025 * Autor: Gemini * Descripción: Utiliza emojis de un solo caracter Unicode para maximizar la * compatibilidad con firewalls y proxies que corrompen emojis complejos. */ document.addEventListener('DOMContentLoaded', () => { setTimeout(() => { try { // --- CONFIGURACIÓN DE EMOJIS SIMPLES --- const trackingMap = { direct: "\u{2B50}", // ⭐ organic: [ { source: "google", name: "\u{2600}\u{FE0F}" }, // ☀️ { source: "instagram", name: "\u{1F4F7}" }, // 📷 { source: "facebook", name: "\u{1F44D}" } // 👍 ], utms: [ // FB / Instagram { utm_source: "fb-ig", utm_medium: "post-cpc", name: "\u{1F44D}" }, // 👍 { utm_source: "fb-ig", utm_medium: "story-cpc", name: "\u{1F4F7}" }, // 📷 { utm_source: "fb-ig", utm_medium: "cpc", name: "\u{1F4B2}" }, // 💲 // Google { utm_source: "google", utm_medium: "cpc", name: "\u{1F4B2}" }, // 💲 { utm_source: "google", utm_medium: "search-cpc", name: "\u{1F50D}" }, // 🔍 { utm_source: "google", utm_medium: "organic", name: "\u{2600}\u{FE0F}" }, // ☀️ // Otros { utm_source: "email", utm_medium: "email", name: "\u{2709}\u{FE0F}" }, // ✉️ ] }; // --- LÓGICA DEL SCRIPT (NO MODIFICAR) --- const getTrackingMarker = () => { const params = new URLSearchParams(window.location.search); const utmSource = params.get('utm_source')?.toLowerCase().trim(); const utmMedium = params.get('utm_medium')?.toLowerCase().trim(); if (utmSource && utmMedium) { const utmMatch = trackingMap.utms.find(u => u.utm_source === utmSource && u.utm_medium === utmMedium); if (utmMatch) return utmMatch.name; } const referrer = document.referrer.toLowerCase(); if (referrer) { const organicMatch = trackingMap.organic.find(o => referrer.includes(o.source)); if (organicMatch) return organicMatch.name; } return trackingMap.direct; }; const whatsAppButton = document.getElementById('whatsappLayout2k0'); if (!whatsAppButton) { return; } const baseHref = whatsAppButton.href.split('?')[0]; const marker = getTrackingMarker(); const newText = `${marker} Hola!`; const newHref = `${baseHref}?text=${encodeURIComponent(newText)}`; whatsAppButton.href = newHref; } catch (error) { console.error("Error en script de trazabilidad v5:", error); } }, 200); });