Overview

Learn how to use event expressions in CQL.

Event expressions let you define conditions based on the history of events in a user's journey. For example, you can check whether a user viewed a specific page today or yesterday, or if they recently abandoned a cart.

Syntax

An event expression starts with an event type, and may include criteria, a quantifier, or a time window:

user has /*<event>*/ /*<criteria>*/ /*<quantifier>*/ /*<window>*/

You can also use negation with not:

user has not /*<event>*/

Here's how you could check if a user has shown interest in smartphones:

user has shown interest in "smartphone"
Try in Playground

Building blocks

These are the parts that make up an event expression:

event

The specific event type to check for.

criteria(optional)

Conditions that further refine which events qualify.

quantifier(optional)

The number of times the event must have occurred.

window(optional)

The period during which the event must have occurred.

Event types

These are the available event types you can use in your expressions:

ExpressionEvent type
user has abandoned a cartCart abandoned
user has abandoned a productProduct abandoned
user has viewed a productProduct viewed
user has placed an orderOrder placed
user has ordered a productProduct ordered
user has viewed a campaignCampaign viewed
user has viewed a pagePage viewed
user has viewed a postPost viewed
user has opened a linkLink opened
user has shown interest in /*<topics>*/Interest shown
user has experienced a custom event /*<name>*/Event experienced
user has completed goal /*<goal-id>*/Goal completed
user has signed inSigned in
user has signed upSigned up