ePrivacy and GPDR Cookie Consent by Cookie Consent Skip to main content

Introduction to Meiro Router

Meiro Router is a real-time engine that receives events, transforms them, resolves identities, and routes the data to external systems such as analytics platforms, CRMs, or internal APIs.

This guide explains how to configure a basic Meiro Router pipeline. We’ll walk through each part of the flow—from collecting events to sending them to an external destination—using a simple use case: tracking website visitor interactions and routing them to an analytics tool.

By the end of this guide, you'll understand how to:

  • Configure a data source

  • Define event types and schemas

  • Enrich and reshape data with transformation logic

  • Resolve user identities

  • Send data to a destination via an event handler function


Where Meiro Router Fits in the Meiro CDP Stack

Meiro Router is one of the key building blocks of the Meiro CDP (Customer Data Platform) stack. While this guide focuses on event routing, the Router can also feed validated data to internal CDP components such as:

  • Meiro Events – for real-time data processing

  • Meiro Integrations – for syncing data with 3rd-party tools

  • Meiro Business Explorer – for customer profile views and audience segmentation

  • Meiro Data Store – for long-term storage and querying

Router is typically integrated via lightweight SDKs (Web/Mobile) or via APIs. It ingests raw data from your systems, transforms and validates it, and routes it to destinations such as ad platforms, analytics platforms, or data warehouses, or internally within the Meiro ecosystem.


1. Sources

A source defines where events enter the Meiro Router.

Events are typically sent from frontend applications (Web or Mobile) through SDKs or APIs. Each source defines:

  • A data transformation function

  • Supported event types

  • Event payload schema

Example source:
A website called Meiro Store simulates a retail environment. It sends events like page_view or product_viewed directly to Meiro Router.

Example incoming event payload:

{
  "event": "product_viewed",
  "user_id": "2f52f9c1-8e45-4e4e-804b-918ef1e217d1",
  "product_id": "abc-001",
  "event_time": "2025-07-01T12:34:56Z"
}

2. Events

Events represent user actions or behaviors (e.g. page views, product views, signups).

Each event type can define:

  • JSON Schema for validation

  • Identity resolution rules

  • Optional event handler function (for routing to external systems)

  • Otional reduced payload (for performance optimization)

Example event types:

  • page_view: Captures when a user visits a webpage

  • event: A more generic handler for unstructured events

Example event schema (simplified):

{
  "type": "object",
  "required": ["user_id", "event_time", "data"],
  "properties": {
    "user_id": {
      "type": "string",
      "format": "uuid"
    },
    "event_time": {
      "type": "string",
      "format": "date-time"
    },
    "data": {
      "type": "object",
      "properties": {
        "page_title": { "type": "string" },
        "url": { "type": "string" }
      }
    }
  }
}

Events are validated against this schema before they are processed.


3. Transformation Lambda

A transformation lambda is a JavaScript function that allows you to reshape or enrich the incoming event data before it’s processed.

Typical transformations include:

  • Adding client IP address

  • Wrapping raw events in a standardized format

  • Removing irrelevant fields

Example transformation:

function process(payload, { requestHeaders }) {
  function getClientIpAddress(headers) {
    const xForwardedFor = headers['x-forwarded-for'] || headers['X-Forwarded-For'];
    if (!xForwardedFor) return null;
    const ips = xForwardedFor.split(',').map(ip => ip.trim());
    return ips[0] || null;
  }

  const clientIp = getClientIpAddress(requestHeaders);

  return {
    event_time: payload.event_time,
    event_type: payload.event,
    event_payload: {
      ...payload,
      ip_address: clientIp
    }
  };
}

This wraps the original event and adds an ip_address field for further processing or analytics.


4. Identity Resolution

Meiro Router includes built-in identity resolution. This allows incoming events to be linked to user profiles based on identifiers.

Each event schema can include identity resolution rules that define:

  • Which field(s) in the event payload should be used

  • What kind of identity does it represent

Example:

  • Identifier: Website user ID

  • Path in event: $.user_id

This ensures that even if the same user performs multiple actions across devices, they can be unified under one profile.


5. Event Handler Lambda

An event handler lambda defines what should happen after the event has been validated and resolved.

Most commonly, this is where the Router sends the processed event to an external system, such as Analytics tools, Ads, and Data Warehouses.

Example handler:

function process(payload) {
  const eventName = payload.event_type;
  const distinctId = payload.event_payload.user_id;
  const properties = payload.event_payload;

  const analyticsEvent = {
    event: eventName,
    properties: {
      distinct_id: distinctId,
      ...properties
    }
  };

  // sendToAnalyticsPlatform(analyticsEvent); // Replace with real integration
}

Summary

This guide walks through a typical Meiro Router use case:

Collecting events from applications using SDKs or APIs.
Transforming and validating payloads using custom JavaScript functions.
Resolving identities using identifiers in the event payload.
Routing events to external platforms (ads, analytics, DWH) or into the Meiro CDP stack.


Meiro Router is flexible enough to support a wide range of data flow setups — whether you’re activating users on ad platforms, pushing events to BI tools, or centralizing them in your own CDP environment.