Skip to main content

How to use Segment & Event Filtering?

Updated over 2 months ago

Mida allows you to control who sees an A/B test using segment filtering and event filtering. These filters ensure that experiments are only shown to relevant users.


Segment Filtering

Segment filtering targets users based on historical user attributes. An A/B test will only be shown to users who have previously met the defined conditions.

Segment filters operate on attributes that were set during earlier interactions and stored in Mida.


Segment Matching Conditions

1. Existence

Value

Label

Description

ex

Exists

The attribute exists for the user

nx

Does not exist

The attribute does not exist for the user


2. String

Value

Label

Description

==

Is equal to

The attribute equals the given value

!=

Is not equal to

The attribute does not equal the given value

**

Contains

The attribute contains the given value

!*

Does not contain

The attribute does not contain the given value


3. Boolean (attribute-based)

Value

Label

Description

bt

Is true

The attribute value is true

bf

Is false

The attribute value is false


4. Number (attribute-based)

Value

Label

Description

gt

Greater than

The attribute value is greater than the given value

gte

Greater than or equal to

The attribute value is greater than or equal to the given value

lt

Less than

The attribute value is less than the given value

lte

Less than or equal to

The attribute value is less than or equal to the given value


5. Date (days ago)

Value

Label

Description

days_gt

More than (days ago)

The attribute occurred more than X days ago

days_gte

At least (days ago)

The attribute occurred at least X days ago

days_lt

Less than (days ago)

The attribute occurred less than X days ago

days_lte

At most (days ago)

The attribute occurred at most X days ago


6. Time-based (day of week / hour of day)

Value

Label

Description

==

Is equal to

Matches the specified time value

!=

Is not equal to

Does not match the specified time value

>

Is after

Occurs after the specified time

>=

Is after or on

Occurs after or on the specified time

<

Is before

Occurs before the specified time

<=

Is before or on

Occurs before or on the specified time


User Identification (Required for Segments)

Segment filtering requires users to be identified so attributes can be stored and reused.

Identify calls support queue-based usage and should be sent as early as possible.

<script>   
window.mdq = window.mdq || [];
window.mdq.push([ "identify", {
id: 123,
plan_id: "premium",
company: "Example Company"
}]);
</script>

Event Filtering

Event filtering allows you to target users based on historical events they have triggered.

Event filtering is split into two distinct concepts:

  1. Which event the user has triggered (targeting)

  2. Conditions on event properties (filtering)

Event Rules (Which Event Was Triggered)

Event rules are used to decide whether a user is eligible to see a test based on event history.

Only two matching conditions are supported.

Value

Label

Meaning

equal

Equal

The user has triggered the specified event

notEqual

Not Equal

The user has not triggered the specified event

Event Attribute Conditions (Event Properties)

Event attribute conditions are used when filtering events or conversions by properties attached to the event.

Value

Label

=

Equals

!=

Not equals

**

Contains

!*

Not contains

>

Greater than

>=

Greater than or equal to

<

Less than

<=

Less than or equal to

Event Tracking

Events must be tracked in order to be used for event filtering.

Queue-based tracking is recommended.

<script>   
window.mdq = window.mdq || [];
window.mdq.push(["track", "subscribe"]);
</script>

Tracking events with properties:

<script>   
window.mdq = window.mdq || [];
window.mdq.push(["track", "purchase", {"price": 120, "currency": "USD"}]);
</script>

HTML-based tracking:

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

Summary

  • Segment filtering targets users based on stored user attributes.

  • Event filtering targets users based on historical events.

  • Event rules determine whether a user has triggered an event, while event attribute conditions filter based on event properties.

  • Using both together ensures experiments are shown only to relevant users.

Did this answer your question?