Timestamp Rules for Building Segments
Timestamp rules aren’t always easy. You want to make sure you send opportune messages and campaigns to your users, using timestamp rules in your segments. But this process may require some deep thinking around when things happen, not just for one person but for a lot of people, and when you want your campaign to go out in relation.
To help you get going, we’ve put together a couple of quick timestamp segment recipes and explanations here, with common use cases in mind. (This tutorial assumes that you’ve integrated with and are sending data to Customer.io.
When building your segments, you’ll see a menu like this for attributes:
There are various options here, and we’ll go through each one in turn:
1. is a timestamp
Despite being the most basic-looking rule, this one can sometimes be the trickiest! If you have a person belonging to a segment with just the rule
created_at is a timestamp, they’ll never leave it.
Customer.io ships with a default Signed up segment, which includes all of your users, including those who matched in the past (as long as they have the required
created_at attribute). This rule is often used as a baseline trigger segment, along with others, for a triggered campaign—and is best shown with an example:
Say we want to send a particular campaign to all new sign-ups in Canada. This is what that campaign trigger would look like:
For this type of campaign, you probably want to send to all new sign-ups going forward in time. To do so, you’d set your campaign to include Future matches only. That way, this campaign won’t message all of your Canadian users who are already signed up. When new users sign up, they will enter the “Signed up” segment and, due to the filter, will only receive the campaign if they are in Canada.
(If you wanted this campaign to include Canadian users who have signed up in the past and in the future, you’d set the campaign to match “Existing and future matches.”)
2. Is a timestamp before X days from now
Want to send users payment reminders? This is the timestamp rule you want to use.
Check out this example segment:
This segment checks what the time is 7 days from now. Then it checks a customer’s
next_payment_date. When the difference between
next_payment_date and now is 7 days, the user enters the segment.
Using this segment as a trigger for a “reminder” campaign means that users will receive your messages exactly 7 days before their next_payment_date. Then, you can update the value of the
next_payment_date, and people will re-enter your campaign as long as the campaign’s Frequency setting lets people re-enter the campaign every month.
3. is a timestamp before X days ago
Want to target your most loyal users, ones who have signed up and been active for more than a year or two? Try this:
This timestamp rule is looking for people who signed up over a year ago. Let’s break it down:
is a timestamp before checks a time (in this case, 365 days ago) against the attribute you choose (in this case,
created_at). If the attribute timestamp is before that time, then the user enters the segment.
So this example segment checks if the user was created any time before one year ago. You can combine this rule with other attributes or rules (a particular persona, or performed a particular event, etc.) to send your campaigns.
4. is a timestamp after X days from now
This is one of the harder timestamp rules to use, but allows you to be very specific in which messages you plan to send.
For example: I have a special feature release planned for next month. I want to send a specific “We have something awesome coming your way” newsletter about that release, and only to people who I’m sure will be users of my app then. For this example, that means their account isn’t expiring in the next 30 days.
This is what that segment I’d use to trigger that newsletter would look like:
In this case, Customer.io checks what the expiry date timestamp will be 30 days from now, and compares it to the user’s attribute. If the attribute timestamp is at least 30 days in the future, the user matches the segment. As soon as the expiry date is less than 30 days, the user will exit the segment. This is good for sending newsletters based on your users’ current state in your app.
You could also use this segment to do research. Let’s say I want to check in with super active users whose accounts are set to expire in 30 days. This segment will tell me which “power user” accounts will expire next month.
I can use this segment to send them a message, or I can export this segment and use the list to reach out personally (handy!). This is an example of how Customer.io can be used for research or data analysis, and help you get to know your customers better.
5. is a timestamp after X days ago
This is a useful rule to message everyone who has done something in the past within a specific span of time. For example, you can use this type of timestamp rule to segment for users who have signed up for your app in the last 24 hours, like this:
They’ll enter this segment as soon as they sign up, and will exit the segment as soon as more than one day passes.
6. is a timestamp before X date
is a timestamp before a specific date of X will match users whose date is before X. This condition can be used if you want to send messages to users for whom an attribute is a timestamp before a date.
For example, say we want to send a message to people who signed up for our app before December 1st. This is how we would do that:
This segment includes all the users who signed up before the timestamp 1575158400: December 1st, 2019, 12:00:00 GMT.
7. is a timestamp after X date
is a timestamp after a specific date of X will match users whose date is after X. This condition can be used if you want to send messages to users for whom an attribute is a timestamp after a date.
For example, say we want to send a message to people who signed up for our app after December 1st. This is how we would do that:
This segment includes all the users who signed up after the timestamp 1575158400: December 1st, 2019, 12:00:00 GMT.
8. is a timestamp between X date and Y date
is a timestamp between X and Y will match users whose date is between X and Y. This condition can be used if you want to send messages to users for whom an attribute is a timestamp between two dates.
For example, say we want to send a message to people who signed up for our app in December. This is how we would do that:
This segment includes all the users who signed up between the timestamps 1575158400 and 1577750400: December 1st, 2019, 12:00:00 GMT and December 31st, 2019, 12:00:00 GMT, inclusive.
That’s it! Some basic timestamp recipes with use cases. We know that this can get pretty complex pretty fast, so if you have any questions about timestamps or have a use case that’s got you stumped, please get in touch!