Time window
Learn how to use time-based filters in event expressions.
Time windows let you restrict event expressions to events that occurred within a specific time frame. They are useful for checking recent activity or events that happened during a particular period.
Syntax
The syntax for time windows is as follows:
Predicate | Description |
---|---|
today | Matches events that occurred today |
yesterday | Matches events from yesterday |
this week | Matches events in the current calendar week |
this month | Matches events in the current calendar month |
this year | Matches events in the current calendar year |
this session | Matches events in the current SDK session |
last session | Matches events from the last closed session |
last week | Matches events in the previous calendar week |
last month | Matches events in the previous calendar month |
last year | Matches events in the previous calendar year |
in last /*<duration>*/ | Matches events in a custom duration |
in the last /*<duration>*/ | Same as above—just an alternative syntax |
Examples
Check if a goal was completed today:
user has completed goal "checkout-started" today
Check if a user signed up yesterday:
user has signed up yesterday
Check if a product was viewed this session:
user has viewed a product this session
Check if a goal was completed last session:
user has completed goal "checkout-started" last session
Check if a custom event occurred last week:
user has experienced a custom event "subscription-applied" last week
Check if any order was placed in the last 5 days:
user has placed an order in last 5 days