Menu
 

Segmentation and Timestamp Rules

When you created your Customer.io account, you likely saw a default segment called “Signed up” that uses the rule created_at is a timestamp.

Segments - Signed up segment

What does “is a timestamp” even mean?

is a timestamp tells the application to match users to your segment at the date and time value of the attribute you choose.

is a timestamp = match users at this date

Example

If created_at is 1461859200 (April 28, 2016, 4:00:00 pm), the user will match the segment April 28, 2016 at 4:00:00 pm.

Why are all signed-up users in this segment?

A user who enters a segment using only the rule created_at is a timestamp rule will never exit, so the segment itself contains all the users who matched in the past. However, when you add a created_at is a timestamp segment as a trigger in a segment triggered campaign, it will only send to the new users that get added to the segment because all campaigns are forward-looking.

is a timestamp is best used when you want to send an email on a certain date or X days after a certain date (by using delays).

Example

Say you want to create a campaign that sends to all users 7 days from signup as long as their age is under 25 and they like pop music. How would that look like using created_at is a timestamp?

  • Trigger segment: created_at is a timestamp
  • Filter segments: segment with the rule age is less than 25 AND segment with the rule favorite_music_type is equal to pop
  • Email delay: 7 days

How does this work exactly?

When users signs up, they are added to the campaign and the clock starts ticking. Once 7 days pass (the delay you chose), the users get checked against the filter criteria (Is the user age under 25? Is pop their favorite music type?). If the filters are matched, so if the users belong to those two segments 7 days after signing up, an email goes out. If not, the users exit the campaign.

Why not just add all the rules in one segment?

Each rule inside a segment has a particular matching time and the overall matching time of the segment is dictated by the last rule matching, so the matching time for a segment with the rules:

created_at is a timestamp

AND

age is less than 25

AND

favorite_music is equal to pop

would actually be the time when the last rule of the segment matches. If the users adds their age and their favorite music at the time the account is created, this segment will have the same matching time as the created_at is a timestamp one if you only add new users, but this is often not the case, so instead of calculating 7 days from the moment the account was created, a campaign using the segment above will likely calculate 7 days from the moment the age or the favorite music type fields on the user profiles have been filled and/or sent as attribute updates to Customer.io

Other timestamp rules and their interpretations

1. is a timestamp after X days from now

is a timestamp after X days from now = match users whose date is at least X days in the future

Example

delivery_date is a timestamp after 3 days from now

If today is November 21, 2016, this segment will only match users whose delivery_date is November 24, 2016 and beyond, so November 25, November 26 and so on.

2. is a timestamp after X days ago

is a timestamp after X days ago = match users whose date is within the past X days

Example:

This type of segment can be helpful if you want to create a newsletter and only send it to users who signed up in the past 7 days to let them know about a special promotion or warn them about a bug.

created_at is a timestamp after 7 days ago will include users whose accounts are less than 7 days old

If today is October 8, 2016, the segment will match users who created their account from October 1, 2016 until now.

3. is a timestamp before X days from now

This type of segment is often used for billing-related campaigns.

is a timestamp before X days from now = match users X days before this date

Example:

If you want to send a payment reminder 7 days before next_payment_date you’ll want to use the following trigger segment rule:

next_payment_date is a timestamp before 7 days from now

Users will receive your email exactly 7 days before their next_payment_date and if you want to add multiple reminders, you just need to add a couple more emails to your workflow:

  • Email 1: No delay
  • Email 2: 4 days (sends 3 days before next_payment_date)
  • Email 3: 7 days (sends on next_payment_date)

Users will never exit segments of this type, so if you want to automatically send payment reminders every month, you’ll need to constantly update the value of the next_payment_date attribute and reach out to our support team to change the campaign settings, so that it can rematch (send more than one email to every user).

4. is a timestamp before X days ago

This type of segment can be used if you want to email older users.

is a timestamp before X days ago = match users whose date is more than X days in the past

Example:

If today is April 28, 2016 and we set up a segment with the rule join_date is a timestamp before 8 days ago, in order for users to match the segment they would need to have a join_date before April 20, 2016.

Note:

If you want to take full advantage of timestamp rules, they are best used as unique rules inside a trigger segment, so that the users can match the time condition and have their email delay calculated from that moment onwards.

If you have specific questions regarding how timestamps work, have a look at our FAQ.