Skip to main content

How to identify user with API?

Updated over a week ago

The Identify API lets you attach custom user attributes (such as plan, customer status, or account type) to a visitor. These attributes can then be used for targeting experiments and personalizations, and for post-segmentation in A/B test reports.

What it does?

When you identify a user, Mida:

  • Stores the provided attributes on the visitor profile

  • Persists them across sessions

  • Makes them available for targeting and reporting

Mida automatically UTMs data in user attribution. The Identify API adds product and business context from your app.

How to use it?

Call identify from the browser once the user data is available (e.g. after login).

// Make sure Mida tracking script is present on the page
window.mdq = window.mdq || [];
window.mdq.push(["identify", {
    id: 123,
    email: "[email protected]",
    is_customer: true,
    plan_name: "gold",
    last_login: "2025-01-15", // Date (YYYY-MM-DD) - for "days ago" comparisons
    subscription_start: "2024-06-01T10:30:00", // Date with time (ISO format)
    custom_property_1: "Any property here",
    custom_property_2: "Any property here"
}]);

You can send any custom key/value pairs (e.g. is_customer, plan_name, account_type, etc.).

Using Identified Attributes for Targeting

Identified attributes appear in:

Targeting Rules β†’ Behavior & Analytics Targeting β†’ Segment Rules

Example:

  • Show an experiment only when:

    • is_customer = true

    • AND (paid_id = gold OR silver)

Using Attributes in Reports (Post Segmentation)

The same attributes can be used after the test in A/B test reports to filter and compare results.

Example analyses:

  • Gold vs Silver users

  • Customers vs non-customers

  • Plan-specific conversion differences

Summary

The Identify API:

  • Enriches visitors with business context

  • Enables precise targeting in experiments and personalizations

  • Unlocks powerful post-segmentation analysis in reports

Did this answer your question?