Advanced

Audience Activation Activacion de Audiencias

Build behavioral segments from your event data and push them to ad platforms for retargeting, suppression, winback, and lookalike campaigns. Construye segmentos de comportamiento de tu data de eventos y envialos a plataformas de ads para retargeting, supresion, winback y campanas lookalike.

What Are Audiences? Que son las Audiencias?

Audiences are segments of users built from behavioral data collected by RELO. They allow you to target, suppress, or re-engage users across ad platforms based on their actual purchase and browsing behavior. Las audiencias son segmentos de usuarios construidos de data de comportamiento recolectada por RELO. Te permiten targetear, suprimir, o re-enganchar usuarios en plataformas de ads basado en su comportamiento real de compra y navegacion.

Audiences are built from ClickHouse queries against the full event history and cached in DragonflyDB for fast membership lookups. Las audiencias se construyen de queries a ClickHouse contra el historial completo de eventos y se cachean en DragonflyDB para lookups rapidos de membresia.

Audience Types Tipos de Audiencias

TypeTipo DescriptionDescripcion RefreshActualizacion Use CaseCaso de Uso
retargeting Cart abandoners, product viewersAbandonadores de carrito, viewers de producto HourlyCada hora Re-engage users who showed intentRe-enganchar usuarios que mostraron intencion
suppression Recent purchasersCompradores recientes Real-timeTiempo real Exclude buyers to avoid ad wasteExcluir compradores para evitar desperdicio de ads
winback Lapsed high-value buyers (30+ days inactive)Compradores de alto valor inactivos (30+ dias) DailyDiario Re-activate dormant valuable usersRe-activar usuarios valiosos dormidos
lookalike Top converters as ML training seedTop convertidores como semilla de ML WeeklySemanal Find new users similar to best buyersEncontrar nuevos usuarios similares a mejores compradores
cross-sell Bought segment A, likely to buy BCompro segmento A, probable que compre B WeeklySemanal Promote complementary productsPromover productos complementarios

How Audiences Are Built Como se Construyen las Audiencias

-- Example: High-value Samsung mobile buyers who haven't purchased in 30 days
-- This query runs in ClickHouse against the full events table

SELECT DISTINCT device_id
FROM events
WHERE client_id = 3                            -- Samsung
  AND product_line = 'MX'                      -- Mobile segment
  AND event_type = 'purchase'
  AND revenue > 15000                          -- High value (> $15K MXN)
  AND event_time > now() - INTERVAL 180 DAY    -- Purchased in last 6 months
  AND event_time < now() - INTERVAL 30 DAY     -- But not in last 30 days
  AND bitAnd(consent_flags, 4) = 4             -- Consented to DSP export

-- Result: ~12,000 device_ids
-- These are stored in DragonflyDB as a set for fast membership checks
-- SET audience:winback_mx_highvalue {device_id_1, device_id_2, ...}

RFM Segmentation Segmentacion RFM

RELO uses RFM analysis (Recency, Frequency, Monetary) to automatically score and segment users. The RFM materialized view in ClickHouse refreshes every 5 minutes. RELO usa analisis RFM (Recencia, Frecuencia, Monetario) para puntuar y segmentar usuarios automaticamente. La vista materializada RFM en ClickHouse se actualiza cada 5 minutos.

DimensionDimension Score 5 (Best)Score 5 (Mejor) Score 1 (Worst)Score 1 (Peor)
Recency Purchased in last 7 daysCompro en ultimos 7 dias Last purchase > 90 days agoUltima compra hace > 90 dias
Frequency 5+ purchases in 6 months5+ compras en 6 meses 1 purchase only1 sola compra
Monetary Total spend > $50K MXNGasto total > $50K MXN Total spend < $2K MXNGasto total < $2K MXN

Typical RFM segments derived from scores: Segmentos RFM tipicos derivados de los scores:

SegmentSegmento RFM PatternPatron RFM ActionAccion
ChampionsCampeonesR=5, F=5, M=5Lookalike seed, loyalty rewardsSemilla lookalike, recompensas de lealtad
At RiskEn RiesgoR=1-2, F=4-5, M=4-5Winback campaignsCampanas de winback
New CustomersClientes NuevosR=5, F=1, M=1-3Nurture, cross-sellNurturing, cross-sell
HibernatingHibernandoR=1, F=1, M=1Exclude or heavy discountExcluir o descuento fuerte

Consent Requirements Requisitos de Consentimiento

Audiences that are exported to DSPs always require bit 2 (0x04) — DSP Export in the consent bitmask. This is enforced server-side regardless of the audience definition. Las audiencias que se exportan a DSPs siempre requieren bit 2 (0x04) — DSP Export en el bitmask de consentimiento. Esto se aplica del lado del servidor sin importar la definicion de la audiencia.

// Consent bitmask (default 0xFF = all enabled, Mexico LFPDPPP is opt-out)

Bit 0 (0x01): Analytics           - Basic event tracking
Bit 1 (0x02): Personalization     - Product recommendations
Bit 2 (0x04): DSP Export          - REQUIRED for audience export
Bit 3 (0x08): Cross-Client        - Share identity across RELO clients
Bit 4 (0x10): Email               - Email marketing
Bit 5 (0x20): Push                - Push notifications
Bit 6 (0x40): Extended Retention  - Keep data beyond 24mo TTL
Bit 7 (0x80): Reserved

// Check in query: WHERE bitAnd(consent_flags, 4) = 4

Export Destinations Destinos de Exportacion

PlatformPlataforma MethodMetodo Event TypesTipos de Evento LatencyLatencia
Meta (Facebook/Instagram) Conversions API (CAPI) Purchase, AddToCart, ViewContent, InitiateCheckout Real-time (batched every 5s)Tiempo real (batch cada 5s)
Google Ads Enhanced Conversions API Purchase, Custom conversions Near real-timeCasi tiempo real
TikTok Events API Purchase, AddToCart, ViewContent Real-timeTiempo real
DV360 Audience API Audience listsListas de audiencia Daily batchBatch diario
The Trade Desk First-Party Data API + UID2 Audience segmentsSegmentos de audiencia Daily batchBatch diario

Meta CAPI Integration Details Detalles de Integracion Meta CAPI

Purchase events are sent to Meta in real-time via the Conversions API. The Go backbone batches up to 1,000 events per request and sends every 5 seconds. Matching keys include: Los eventos de compra se envian a Meta en tiempo real via la Conversions API. El backbone en Go agrupa hasta 1,000 eventos por request y envia cada 5 segundos. Las llaves de matching incluyen:

Product Affinity & Cross-Sell Afinidad de Producto & Cross-Sell

RELO computes a product affinity matrix from ClickHouse purchase data. This identifies which products are frequently bought together, enabling cross-sell audiences. RELO calcula una matriz de afinidad de producto de los datos de compra en ClickHouse. Esto identifica que productos se compran frecuentemente juntos, habilitando audiencias de cross-sell.

-- Product affinity query (ClickHouse materialized view)
-- Finds: "Users who bought Galaxy S24 also bought Galaxy Buds"

product_a: Galaxy S24 Ultra  |  product_b: Galaxy Buds Pro  |  co_purchase_count: 234
product_a: Galaxy S24 Ultra  |  product_b: Galaxy Watch 6   |  co_purchase_count: 189
product_a: QLED 65" TV       |  product_b: Soundbar Q990C   |  co_purchase_count: 156

-- Cross-sell audience: users who bought product_a but NOT product_b
-- Export to Meta for targeted retargeting campaigns

Cohort Retention Analysis Analisis de Retencion por Cohortes

RELO tracks cohort retention — grouping users by their first purchase month and tracking how many return in subsequent months. This feeds into winback audience timing. RELO trackea la retencion por cohortes — agrupando usuarios por su mes de primera compra y trackeando cuantos regresan en meses posteriores. Esto alimenta el timing de audiencias de winback.

-- Cohort retention matrix (ClickHouse materialized view)

Cohort    | Month 0 | Month 1 | Month 2 | Month 3 | Month 6
----------|---------|---------|---------|---------|--------
Jan 2026  | 100%    | 18%     | 12%     | 9%      | 5%
Feb 2026  | 100%    | 22%     | 14%     | -       | -
Mar 2026  | 100%    | -       | -       | -       | -

-- Key insight: ~18-22% of buyers return within 30 days
-- After 30 days, drop-off is steep -> winback window = 30-90 days
Optimal winback timing: Cohort analysis shows that the best winback window is 30-60 days after last purchase. Users who haven't returned after 90 days have very low probability of returning without heavy incentives. Timing optimo de winback: El analisis de cohortes muestra que la mejor ventana de winback es 30-60 dias despues de la ultima compra. Usuarios que no han regresado despues de 90 dias tienen muy baja probabilidad de regresar sin incentivos fuertes.

API: Build an Audience API: Construir una Audiencia

POST https://ingest.relo.mx/audiences/build
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "client_id": 3,
  "name": "Winback - MX High-Value 30-90d",
  "audience_type": "winback",
  "within_days": 180,
  "inactive_days": 30,
  "min_revenue": 15000,
  "filter": {
    "product_line": "MX",
    "require_consent": 4
  }
}

// Response 200:
{
  "audience_id": "01HXYZ123456789ABCDEFGHIJ",
  "name": "Winback - MX High-Value 30-90d",
  "device_count": 12450,
  "status": "built",
  "built_at": "2026-03-18T15:30:00Z"
}