Event experienced
Learn how to check whether a user has experienced a custom event.
This expression checks whether a custom event occurred for the user. Custom events allows tracking specific actions that are not covered by standard events, such as "subscription-applied", "newsletter-joined", or any other action relevant to your application.
This expression uses the Event occurred event. Without this event, the expression will always evaluate to false.
Syntax
The basic syntax for this expression is:
user has experienced custom event /*<name>*/
You can optionally include the article for better readability:
user has experienced a custom event /*<name>*/
The negation of the expression can be expressed as:
user has not experienced a custom event /*<name>*/
You can refine the expression with criterias, quantifiers, and time windows:
user has experienced a custom event /*<name>*/ /*<criteria>*/ /*<quantifier>*/ /*<window>*/
Parameters
These are the supported parameters:
- nameString
The name of the custom event.
For example, "subscription-applied", "newsletter-joined".
- criteria(optional)
Additional filtering criteria for the event experienced.
- quantifier(optional)
A quantifier to specify how many times the custom event must have been occurred.
- window(optional)
The time window during which the custom event must have been occurred.
Event properties
The following event properties can be used within criteria expressions:
- detailsobject
The details of the event.
For example:
"details": { "productId": "12345", "rating": 5}
Examples
You can check whether a user has experienced a specific custom event:
user has experienced a custom event "subscription-applied"
Or check that the user has not experienced it:
user has not experienced a custom event "subscription-applied"
You can also add criteria, for example verifying a rating stored inside details:
user has experienced a custom event "product-rated" with details.rating 5
Or check if a user experienced a custom event exactly 3 times:
user has experienced a custom event "product-rated" exactly 3 times
You can even filter by time, such as checking if it happened yesterday:
user has experienced a custom event "subscription-applied" yesterday
Combine criteria, counts, and time windows in one expression:
user has experienced a custom event "product-rated" with details.rating 5 at least 2 times last month