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.
Please be aware that backfilling event data may trigger campaigns or messages, if those events are used as triggers!
- A backdated event WILL trigger event-triggered campaigns if the event’s timestamp is within the last 3 days (72 hours).
- A backdated event WILL NOT trigger event-triggered campaigns if the event’s timestamp is older than 3 days (72 hours).
We only show activity for the last 30 days in Customer.io.
Events that are older than 30 days are logged for use in segmentation (e.g., “event made_purchase
has been performed at least once”) but they won’t appear in your activity logs.
Below are a couple examples for adding historical event data. The following examples are for our US region. If your account is based in the EU, replace track.customer.io
with track-eu.customer.io
.
cURL:
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 (JSON):
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}}'
If you need help on any of these issues, please get in touch.