Backfill historical data
UpdatedAs 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 send historical event data to Customer.io 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.. See our Data Pipelines API (recommended) or classic Track API for more information about track
calls.
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 -X POST https://cdp.customer.io/v1/api/track \
-u api_key: <your_api_key_here> \
-H 'Content-Type: application/json' \
-d '{
"userId": "5",
"event": "purchased",
"properties": {
"price": 23.45
},
"timestamp": 1359389415
}'