Backfill historical data

As you’re getting started with Customer.io, you might want to back-fill your historical data. This page details a few options for backfills.

Backfilling People

1. Advanced: Write a script

If you’re a developer, you may want to write a quick script to loop through all of the people in your database and add them to Customer.io. While this creates a lot of API requests, it’s fine to do and won’t overload our system if you follow the API guidelines.

Note, that your API calls may not be processed in the order you send them. If you will be sending multiple identify() calls per user and chronology of the attribute updates is important to you, you will need to send a _timestamp value as discussed in our documentation on User Attributes.

Libraries

Choose a library for your language of choice

2. Easier: Upload a CSV file

Customer.io shines best when we have access to a stream of real-time data about your users so we’d like to see if there’s anything we can do to help you get this type of data flowing directly into your account.

However, in cases where you need to backfill historical data into your new account or you want to complete one-time imports, you are able to upload a CSV file of users.

For more information, check out: Uploading People via CSV

Advanced: Backfilling Events

You can optionally add historical event data by adding a timestamp to your API call, as shown in the examples below. This helps you keep a history of the things your audience does, or use backdated events for segmentsA group of people who match a series of conditions. People enter and exit the segment automatically when they match or stop matching conditions..

Backfilled events that occurred in the past 72 hours can trigger campaigns or messages. People who performed backfilled events more than 72 hours ago won’t enter campaigns based on that event.

If you base segmentA group of people who match a series of conditions. People enter and exit the segment automatically when they match or stop matching conditions. membership on events, backfilling events will add people to segments correctly. However, if you use event-based segment membership as a campaign trigger, backfilled events will not reliably trigger campaigns.

 Events older than 30 days won’t appear in Activity Logs

If you upload older events, you can still take advantage of them in segments and other places, but they won’t appear in your activity logs.

curl -i https://track.customer.io/api/v1/customers/5/events \
-u YOUR-SITE-ID-HERE:YOUR-SECRET-API-KEY-HERE \
-d name=purchased \
-d data[price]=23.45 \
-d timestamp=1359389415
curl -i https://track.customer.io/api/v1/customers/5/events \
  -X POST \
  -u YOUR-SITE-ID-HERE:YOUR-SECRET-API-KEY-HERE \
  -H 'Content-Type:application/json' \
  -d '{"name":"purchased","timestamp":1359389415, "data":{"price":23.45}}'

If you want to also use the event timestamp to customize your emails, you can add an additional attribute to the data hash like this:

curl -i https://track.customer.io/api/v1/customers/5/events \
  -X POST \
  -u YOUR-SITE-ID-HERE:YOUR-SECRET-API-KEY-HERE \
  -H 'Content-Type:application/json' \
  -d '{"name":"purchased","timestamp":1359389415, "data":{"price":23.45, "timestamp":1359389415}}'
Copied to clipboard!
  Contents
Is this page helpful?