Guide

Web Pixel Integration Integracion del Web Pixel

Track everything on your website with a single JS snippet. Trackea todo en tu sitio web con un solo snippet de JS.

1

Add the pixel to your site Agrega el pixel a tu sitio

Paste this in your <head> tag. Replace YOUR_CLIENT_ID with the ID we give you. Pega esto en tu tag <head>. Reemplaza YOUR_CLIENT_ID con el ID que te damos.

<script>
// RELO Pixel — paste in <head>
(function(r,e,l,o){
  r.relo=r.relo||function(){
    (r.relo.q=r.relo.q||[]).push(arguments)
  };
  o=e.createElement('script');
  o.async=1;
  o.src=l;
  e.head.appendChild(o);
})(window,document,'https://p.relo.mx/r.js');

relo('init', { client_id: YOUR_CLIENT_ID });
relo('page');
</script>
2

Track purchases (optional but recommended) Trackea compras (opcional pero recomendado)

Fire this on your "thank you" / order confirmation page: Dispara esto en tu pagina de "gracias" / confirmacion de orden:

relo('event', 'purchase', {
  order_id: 'MX260312-12345',
  revenue:  24999,
  currency: 'MXN',
  products: [
    { id: 'SKU-001', name: 'Galaxy S24', price: 24999, qty: 1 }
  ]
});
3

That's it! Check your data Eso es todo! Revisa tus datos

Events will appear in your RELO dashboard within seconds. You can also check the health endpoint to verify the pixel is sending data. Los eventos apareceran en tu dashboard de RELO en segundos. Tambien puedes checar el endpoint de health para verificar que el pixel esta enviando datos.

Advanced Features (v3) Funciones Avanzadas (v3)

SHA-256 Device Fingerprinting Fingerprinting de Dispositivo SHA-256

The pixel collects 16 device signals (screen, timezone, languages, WebGL renderer, audio context, etc.) and generates a SHA-256 fingerprint using the async SubtleCrypto API. A djb2 hash fallback is used for browsers without SubtleCrypto. The fingerprint is included in every event for cross-session identity resolution. A fp_ready event fires when the fingerprint is computed. El pixel recolecta 16 senales del dispositivo (pantalla, zona horaria, idiomas, WebGL renderer, audio context, etc.) y genera un fingerprint SHA-256 usando la API asincrona SubtleCrypto. Un hash djb2 se usa como fallback para navegadores sin SubtleCrypto. El fingerprint se incluye en cada evento para resolucion de identidad cross-session. Un evento fp_ready se dispara cuando el fingerprint esta calculado.

Attention & Engagement Tracking Tracking de Atencion & Engagement

Automatically tracks active/hidden time on page (active_sec, hidden_sec) with a reason field (tab switch, minimize, etc.) and double-fire guard. Section-level attention tracking uses IntersectionObserver (0.1 threshold) to fire section_view events with 1-second dwell time minimum and a 500-object cap to prevent memory issues. Trackea automaticamente tiempo activo/oculto en pagina (active_sec, hidden_sec) con campo reason (cambio de tab, minimizar, etc.) y proteccion contra doble disparo. El tracking de atencion a nivel de seccion usa IntersectionObserver (threshold 0.1) para disparar eventos section_view con tiempo minimo de permanencia de 1 segundo y limite de 500 objetos para prevenir problemas de memoria.

Network Quality Detection Deteccion de Calidad de Red

Detects connection quality using navigator.connection API when available, with an XHR /ping RTT fallback for unsupported browsers. Fires a net_quality event with effective type (4g, 3g, 2g), downlink speed, and RTT. Used for adaptive content delivery and audience quality scoring. Detecta calidad de conexion usando la API navigator.connection cuando esta disponible, con un fallback XHR /ping RTT para navegadores no soportados. Dispara un evento net_quality con tipo efectivo (4g, 3g, 2g), velocidad de descarga y RTT. Usado para entrega adaptiva de contenido y scoring de calidad de audiencia.

Cross-Domain Identity Identidad Cross-Domain

For clients with multiple domains, the pixel supports cross-domain identity linking via relo('init', {domain: '.yourdomain.com'}). The cookie domain is sanitized and capped at 3KB. This links user sessions across subdomains for unified attribution. Para clientes con multiples dominios, el pixel soporta enlace de identidad cross-domain via relo('init', {domain: '.tudominio.com'}). El dominio de cookie se sanitiza y se limita a 3KB. Esto enlaza sesiones de usuario entre subdominios para atribucion unificada.

All Tracked Events Todos los Eventos Trackeados

// Automatic events
page_view      — every page load
fp_ready       — fingerprint computed
attention      — active/hidden time on unload
section_view  — section enters viewport (1s dwell)
net_quality   — network quality detected
form_submit   — any <form> submit (PII auto-hashed on blur)
click         — every click (with coordinates, for heatmaps)

// Manual events
view_product  — relo('event', 'view_product', {...})
add_to_cart   — relo('event', 'add_to_cart', {...})
purchase      — relo('event', 'purchase', {...})
lead_submit   — relo('lead', {...}) — see Lead-gen API below
custom        — relo('event', 'my_event', {...})

Lead-gen API — relo('lead', {...}) API de Leads — relo('lead', {...})

For lead-gen clients (insurance, loans, SaaS trial), use the explicit relo('lead', payload) API on your form-submit handler. This is different from the automatic form_submit event — relo('lead', ...) lets you decide which submits count as qualified leads and lets you attach metadata (product, form_id, stage, lead_value) that surfaces in the partner Leads tab. Para clientes de lead-gen (seguros, créditos, trials SaaS), usa la API explícita relo('lead', payload) en tu handler de submit. Distinta del evento automático form_submit: relo('lead', ...) te deja decidir qué submits califican como leads y adjuntar metadata (product, form_id, stage, lead_value) que aparece en el tab de Leads del partner.

// On form submit:
relo('lead', {
  email: 'user@example.com',    // hashed SHA-256 client-side
  phone: '+525555551234',       // hashed SHA-256 client-side
  name: 'Juan Perez',           // identity graph only
  product: 'Auto Insurance',    // shown in Leads tab
  form_id: 'quote-home-v2',
  stage: 'raw',                 // raw / qualified / rejected
  lead_value: 50,
  currency: 'USD',
  utm_source: 'facebook',
  utm_campaign: 'spring-2026',
  extra: {                      // namespaced to x_* in Relo
    coverage: 'full',
    vehicle_year: 2023
  }
});

Whitelisted plain-text fields: product, form_id, lead_source, stage, lead_value, currency, utm_campaign, utm_source, notes, quote_id, product_type. Anything in extra: {...} is copied with an x_ prefix. Campos planos permitidos: product, form_id, lead_source, stage, lead_value, currency, utm_campaign, utm_source, notes, quote_id, product_type. Lo que pase en extra: {...} se copia con prefijo x_.

Privacy: email/phone are hashed with SHA-256 client-side. Partners see only a 12-char prefix of the hash — enough for dedup, not for dictionary attack. Raw PII never leaves the browser. Privacidad: email/teléfono se hashean SHA-256 del lado cliente. Los partners solo ven un prefijo de 12 chars del hash — suficiente para dedup, no para ataques de diccionario. El PII crudo nunca sale del browser.

Attribution: if the visitor came via a t.relo.mx/c/:code click wrapper, the _relo_cid cookie is read server-side and the lead is attributed to that partner. Atribución: si el visitante llegó por un click wrapper t.relo.mx/c/:code, la cookie _relo_cid se lee server-side y el lead se atribuye a ese partner.

Session Replay (rrweb) Session Replay (rrweb)

For pixel clients who opt in, Relo can record full DOM sessions via rrweb and play them back in admin. Useful for debugging form drop-off and confusing UX. Disabled by default — enable per-client in Admin → Client Config → Data Pipeline → Web Pixel → Session Replay. Para clientes pixel que opten, Relo puede grabar sesiones DOM completas con rrweb y reproducirlas en admin. Útil para depurar abandono de formulario y UX confuso. Apagado por default — activar por cliente en Admin → Config Cliente → Data Pipeline → Web Pixel → Session Replay.

// Three gates — ALL must be true for recording to start:
1. replay_enabled = true        // admin-side master switch
2. consent bit 4 (0x10)         // user consent
3. random() < sample_rate / 100 // cost control 0-100

// Privacy defaults:
- All form inputs masked (maskAllInputs: true)
- password / email / phone get extra mask
- no canvas, no fonts
- mousemove disabled (clicks captured)

// Storage:
R2 bucket relo-replays
Key: client={cid}/YYYY-MM-DD/session={sid}/chunk-NNNNN.json.gz
90-day TTL

// Playback:
Admin → Pixel Audit → Replays subtab
Click a session → lazy-loads rrweb-player → stitches chunks from R2

Tracking Types: MMP vs Pixel vs Hybrid Tracking Types: MMP vs Pixel vs Hybrid

Every client has a tracking_type that controls which dashboards partners see. Campaigns can override the client default. Cada cliente tiene un tracking_type que controla qué dashboards ven los partners. Las campañas pueden sobrescribir el default.

mmp     — AppsFlyer / Branch postbacks (Samsung-style)
           Partner portal: Dashboard / Analytics / Orders (MMP)
pixel   — Relo Web Pixel (Quote-style, lead-gen)
           Partner portal: PixelDashboard / PixelAnalytics / Leads
hybrid  — Accept both sources
           Partner portal: defaults to MMP views, pixel visible in admin

Per-client: Admin → Client Config → General. Per-campaign: Campaign Detail → Settings → Tracking Type or Campaign Launch Wizard step 1. Por cliente: Admin → Config Cliente → General. Por campaña: Detalle de Campaña → Settings → Tracking Type o paso 1 del Campaign Launch Wizard.