Skip to content

Send data from Segment to Monita

Segment can forward the events in your workspace to Monita using a webhook destination, or a Destination Function if you want full control of the payload shape.

  • A Segment source receiving events.
  • Your Monita property token and vendor names — see the Monita-side setup.
Section titled “Option A — Destination Function (recommended)”

A Destination Function lets you map Segment’s event shape onto Monita’s exactly:

  1. In Segment, go to Connections → Catalog → Functions → New Function → Destination.

  2. Use a handler like:

    async function onTrack(event, settings) {
    await fetch('https://collect.monita.ai/api/v1/', {
    method: 'POST',
    headers: {
    token: settings.monitaToken,
    'Content-Type': 'application/json',
    },
    body: JSON.stringify({
    s: 'global',
    dm: 'tms',
    e: event.event,
    vn: 'Segment',
    u: event.context?.page?.url,
    do: 'www.your-domain.com',
    sid: event.anonymousId,
    cid: event.userId,
    dt: [{ event: event.event, ...event.properties }],
    }),
    });
    }
  3. Add a monitaToken setting, connect the function to your source, and enable it.

The catalog Webhooks destination can POST to https://collect.monita.ai/api/v1/ with the token header set. Segment will send its own event envelope rather than Monita’s field names — Monita accepts the JSON, but events group best when you use a Destination Function to map e, vn and dt properly.

  1. Check the function’s event delivery log for 204 responses (401 = wrong or missing token).
  2. In Monita, events appear in the property’s Visualisation view within a minute or two.