How to use Segment & Event Filtering?

Created by Donald Ng, Modified on Wed, 12 Mar at 10:00 PM by Donald Ng

Segment Filtering


Segment filtering in Mida allows you to target users based on historical attributes. This means an A/B test will only be shown to users who have previously met the defined conditions. The filtering works based on user attributes that have been set in prior interactions.


Available Matching Conditions for Segments:

  • Exists – The attribute exists for the user.
  • Does not exist – The attribute does not exist for the user.
  • Is equal to – The attribute has a specific value.
  • Is not equal to – The attribute does not have a specific value.
  • Contains – The attribute contains a specified value.
  • Does not contain – The attribute does not contain a specified value.


Mida Identify API for User Segments


To use segment filtering effectively, you can identify users and assign attributes using Mida’s Identify API. This API allows you to propagate user-specific data from your service and store it in Mida for segmentation.


Example Usage:

mida.identify({
    "id": 123,
    "name": "John Doe",
    "email": "john@example.com",
    "company": "Example Company",
    "plan_id": "premium",
    "gender": "male",
});
JavaScript


This data will be stored and can later be used to filter users based on attributes like plan_id or gender before showing them an A/B test.


Event Filtering


Event filtering allows you to show an A/B test only to users who have triggered specific events in the past. This is based on historical event data, ensuring the test is only displayed to qualified users.


Available Matching Conditions for Events:

  • Equal – The user must have triggered the specified event.
  • Not Equal – The user must not have triggered the specified event.


Mida Event API for Tracking Events


To track user interactions, you can send events to Mida when specific actions occur on your website. These events can then be used for event-based filtering.


Example Usage:


Tracking an A/B Test Variant Load:
mida.track("ab_testing", {"variant_name": "variant A"});
JavaScript

Tracking a Button Click Event:
mida.track("subscribe");
JavaScript


Alternatively, you can trigger an event using HTML attributes:

<button class="btn" mida-event="click-cta">Create a free account</button>
HTML


When a user clicks this button, Mida records an event named click-cta, which can be used for filtering.


Summary

  • Segment filtering allows you to target users based on historical attributes set using the Identify API.
  • Event filtering enables targeting based on past user interactions recorded via the Event API.
  • Both methods ensure that only qualified users see the A/B test, improving test accuracy and effectiveness.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article