Overview
Time-based messaging helps you reach users at the right moment—right after they take an action, or right before a key date happens. With Time Operators (also called Time Elapsed operators), you can:- Track an event time by storing a Unix timestamp (seconds) in a user Tag
- Target users based on how many seconds have passed since that timestamp (past events) or how close they are to that timestamp (future events)
- Abandoned Cart Messages: user’s add items to their shopping cart. It is crucial to send them a reminder message if they fail to checkout after a certain amount of time.
- Future event reminders: send messages minutes/hours/days before a scheduled event.
- Subscription expiration reminders: notify users before a subscription ends or payment is due and follow up if they don’t renew.
- Milestones: follow up when a user hasn’t completed an important step by a certain time.
- Birthday messages: send an automated message around a user’s birthday each year.
“Time Elapsed” operators are only available on paid plans. Free plans can still use default time-based segment filters like First Session and Last Session.
Prerequisites
Before you start, make sure you have:- A way to set Tags for a user (SDK or API). See: Tags
- A timestamp source that you control (your app, backend, or website)
- A value in Unix timestamp seconds (not milliseconds)
Tags vs Custom Events
You can solve many “reminder” use cases with either Tags or Custom Events. The best option depends on what you need to store and how you want to trigger automation.- Use Tags when you want to store the latest known timestamp on the user (for example,
cart_updated_atorsubscription_expires_at) and segment off that value over time. - Use Custom Events when you want to record each event occurrence (with properties) and trigger Journeys based on real-time behavior.
In practice, many implementations can use both: Custom Events for real-time tracking and Tags for user state you want to segment on later.
How time operators work
Time Operators compare “now” to a user tag value that contains a Unix timestamp in seconds. What you store You store a Tag where:- The
keyis the event name (any string you choose) - The
valueis a Unix timestamp in seconds (stored as a string) - Example:
'cart_updated_at' : '1706659200'
time_elapsed_seconds = current_time_seconds - tag_timestamp_seconds
That means:
- If the timestamp is in the past,
time_elapsed_secondsis positive - If the timestamp is in the future,
time_elapsed_secondsis negative
Time Elapsed operators
OneSignal supports these operators for User Tag segmentation:- Time Elapsed Greater Than
- Time Elapsed Less Than
- After an event (past timestamp)
- Example: “Send a reminder if it has been more than 1 hour since cart update”
- Before an event (future timestamp)
- Example: “Send a reminder 2 days before an event”
Setup steps & best practices
Convert your date to a Unix timestamp in seconds
Convert the date/time you care about into a Unix timestamp in seconds.Example JavaScript helper (seconds as a string):Example: convert a specific ISO date/time:
Set the Tag on the user
Set a tag where the key identifies the event and the value is the Unix timestamp (seconds) as a string.Example (Web SDK):Example tag stored on the user:
cart_updated_at: "1717228800"Create a Segment using Time Elapsed
Example: add users to a segment 24 hours after the 
cart_updated_at timestamp.- In the OneSignal dashboard, go to Audience > Segments.
- Create a new segment and add the User Tag filter.
- Set KEY to
cart_updated_at. - Choose Time Elapsed Greater Than.
- Set VALUE to
86400(24 hours in seconds).

Best practice: add an upper limit (a time window)
If you only use Time Elapsed Greater Than, users can stay in the segment indefinitely until you update or remove the tag.To limit membership to a window (for example, “between 24 and 48 hours after the event”), add a second filter:
- Time Elapsed Greater Than
86400(24 hours) - Time Elapsed Less Than
172800(48 hours)

As users get tagged, they will automatically enter the segment once the Time Elapsed conditions match. Use the segment in a Journey to automate your messaging.
Target users before a specific date
To message users before a future date, you simply need to:- Convert the future date to a Unix timestamp in seconds
- Set the tag on the user
- Create a Segment using the time elapsed less than operator and the desired time before the date
- Event date is February 1st. Convert it to a Unix timestamp in seconds:
1770076800 - Set it as a tag:
'event_date' : '1770076800' - Create a Segment using the time elapsed less than operator and the desired time before the date:
2 days
Once the Unix timestamp date is reached, the user will be removed from the segment automatically.You can optionally add another time elapsed less than filter to remove the user from the segment after a certain amount of time.

Example: Birthday messages
You can automate birthday messages by tagging each user with the Unix timestamp representing their next upcoming birthday, then using a Journey that re-enters annually.Store the user's next upcoming birthday as a Unix timestamp
This example computes the next birthday based on the current year and then sets the birthday tag.
JavaScript
Create a birthday segment
Create a Segment using a 
birthday tag:- User Tag key:
birthday - Time Elapsed Greater Than
0seconds

Birthday messages will be sent to users around their
birthday tag date.