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" todayCheck if a user signed up yesterday:
user has signed up yesterdayCheck if a product was viewed this session:
user has viewed a product this sessionCheck if a goal was completed last session:
user has completed goal "checkout-started" last sessionCheck if a custom event occurred last week:
user has experienced a custom event "subscription-applied" last weekCheck if any order was placed in the last 5 days:
user has placed an order in last 5 days