Backfill historical data
UpdatedAs you get started with Customer.io, you might want to backfill historical data for people and events. This page helps you get started. Make sure you understand how backfilled data can trigger campaigns, if you’re already up and running.
Backfill people and attributes
You can backfill people and their attributesA key-value pair that you associate with a person or an object—like a person’s name, the date they were created in your workspace, or a company’s billing date etc. Use attributes to target people and personalize messages. Attributes are analogous to traits in Data Pipelines. in your Customer.io account through our integrations or manually in your workspace. You might do this to store all your data within Customer.io so you can create segmentsA segment is a group of people in your audience that you want to target with campaigns, messages, etc. You can join groups of people manually, or by attribues and event data. and campaign logic around them.
Learn more about when backfilled data would trigger campaigns.
Advanced: write a script
If you’re a developer, you can write a script to loop through all of the people in your database and add them to Customer.io. Make sure you follow our API guidelines as it can cause significant API traffic.
We may not process your API calls in the order you send them
If you’re sending multiple identify
calls per user, and the chronology of the attribute updates is important, you must send a _timestamp
value as discussed in our documentation on people’s attributes.
Easier: upload a CSV
Customer.io shines brightest when you send real-time data about your users. However, sometimes you need to backfill historical data or add data not integrated with your Customer.io account, like a list of leads from a conference. In these cases, you can import a CSV file to add or update your people.
Backfill events
You can send historical eventSomething that a person in your workspace did. Events can trigger campaigns, add people to segments, etc. You can access event properties in liquid with {{event.<property>}}
data to Customer.io by adding a timestamp
to your API call, as shown in the examples below. You might do this to store all your data within Customer.io, add people to segmentsA segment is a group of people in your audience that you want to target with campaigns, messages, etc. You can join groups of people manually, or by attribues and event data., or trigger campaigns. See our Data Pipelines API (recommended) or classic Track API for more information about track
calls.
If you base segment membership on events, backfilling events will add people to segments. However, if you use event-based segment membership as a campaign trigger, backfilled events will not reliably trigger campaigns. Learn more about when backfilled data would 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
}'
Backfilled data can trigger campaigns
Backfilled data can trigger campaigns made with a segmentA segment is a group of people in your audience that you want to target with campaigns, messages, etc. You can join groups of people manually, or by attribues and event data. or eventSomething that a person in your workspace did. Events can trigger campaigns, add people to segments, etc. You can access event properties in liquid with {{event.<property>}}
trigger. However, we only trigger a campaign when the backfilled data happened after the campaign started.
Segment-triggered campaigns
After you activate a segment-triggered campaign, you might realize you need to backfill data that would add people to the segmentA group of people who match a series of conditions. People enter and exit the segment automatically when they match or stop matching conditions. that triggers the campaign. If the _timestamp
of the people/attribute change is within 24 hours of when Customer.io processed the data, people can enter the campaign. We say people can enter because it also depends on the campaign’s filter and frequency settings.
For example, let’s say you activated the segment-triggered campaign 10 days ago. Then you backfilled attribute data and looked at your activity log:
The timestamp is today at 11:38:04 am (CST). And it finished processing today at 11:39:04 am (CST). This could trigger your campaign because:
- the timestamp is AFTER the campaign started
- the difference between the timestamp and processed at timestamp is less than 24 hours
However, if your campaign begins with a delay longer than 24 hours, we’ll use the delay length as the maximum difference. For example, if you begin a campaign with a 4 day wait, then the max difference between the timestamp and processed at timestamp is now 96 hours, not 24.
Event-triggered campaigns
After you activate an event-triggered campaign, you might realize you need to backfill event data that would trigger this campaign. If the timestamp
of the event is within 72 hours of when Customer.io processed the data, people can enter your campaign. We say people can enter because it also depends on the campaign’s filter and frequency settings.
For example, let’s say your campaign is triggered when someone completes a survey, and you activated the campaign 10 days ago. Then you backfill event data like this:
The timestamp is today at 11:20:27 am (CST). And it finished processing today at 11:22:40 am (CST). This could trigger your campaign because:
- the timestamp is AFTER the campaign started
- the difference between the timestamp and processed at timestamp is less than 72 hours
However, if your campaign begins with a delay longer than 72 hours, we’ll use the delay length as the maximum difference. For example, if you begin a campaign with a 4 day wait, then the max difference between the timestamp and processed at timestamp is now 96 hours, not 72.