Skip to main content

Offline Event Webhook (Client-side)

Record an offline event for a visitor in Mida from your backend via the /abtest/event/webhook endpoint.

The Offline Event Webhook lets you record an event for a specific visitor in Mida from your own backend or systems — useful when something happens outside the browser that you want to track against a visitor (for example, a server-confirmed signup, a CRM stage change, or an offline action). Recorded events are available as goals or secondary goals in your experiments.

Endpoint

POST https://api-{{region}}.mida.so/abtest/event/webhook

Use the host that matches where your data is hosted:

  • US: https://api-us.mida.so/abtest/event/webhook

  • EU: https://api-eu.mida.so/abtest/event/webhook

Requests must be sent with Content-Type: application/json.

User identification

You must provide at least one of the following identifiers so Mida can match the event to a visitor. If mida_uuid is provided, it is used as the sole identifier; email and id are only used when mida_uuid is absent.

Parameter

Type

Required

Description

mida_uuid

String

Optional*

The unique identifier generated by Mida. Retrieve it in the browser with await mida.uuid(). Alias: uuid.

email

String

Optional*

The visitor's email address, set via the Mida client-side user attribution API.

id

String

Optional*

Your system's user ID, set via the Mida client-side user attribution API.

*At least one of these three must be provided.

Request parameters

Parameter

Type

Required

Description

project_key

String

Yes

Your Mida project (public/widget) key. Alias: mida_project_key.

event_name

String

Yes

The name of the event being recorded (this is how it appears as a goal / secondary goal).

properties

Object

No

Additional custom metadata to store with the event.

Request example

{
  "project_key": "YOUR_PROJECT_KEY",
  "event_name": "signup_completed",
  "mida_uuid": "f8cb2ebe-XXXX-4a4f-a967-85a35aca4df9",
  "email": "[email protected]",
  "id": "internal_user_id",
  "properties": {
    "plan": "pro",
    "source": "backend"
  }
}

Response codes

Responses are returned as a plain-text message with the corresponding HTTP status code.

Status code

Response body

Meaning

200

Event recorded successfully

The event was recorded for the visitor.

400

Missing required fields: project_key (or mida_project_key), event_name, and at least one identifier (mida_uuid or uuid, email, or id)

A required field is missing.

400

Invalid widget key

The project_key could not be resolved to a project.

400

Visitor not found

No visitor matched the identifier(s) provided.

500

Internal server error

An unexpected error occurred.

Usage notes

  • Make sure the Mida script is installed on your site before using this webhook — the visitor must already exist in Mida for the event to be matched.

  • Get the Mida visitor UUID in the browser with mida.uuid(), for example: const mida_uuid = await mida.uuid();

  • Find your project key in your Mida dashboard settings.

  • User identification (email / id) can be set up through the Mida client-side user attribution API.

  • The properties object is optional and lets you attach additional metadata to the event.

  • Recorded events can be selected as goals or secondary goals in your experiments.

Example cURL request

curl -X POST https://api-us.mida.so/abtest/event/webhook \
     -H "Content-Type: application/json" \
     -d '{"project_key": "YOUR_PROJECT_KEY", "event_name": "signup_completed", "mida_uuid": "f8cb2ebe-XXXX-4a4f-a967-85a35aca4df9", "properties": {"plan": "pro", "source": "backend"}}'
Did this answer your question?