Adding previous Event Data as profile attributes

  • 11 October 2023
  • 0 replies
  • 104 views

Introduction

There can be situations where event data is added to Customer.io, and after the fact, you realize this data needs to be added to a customer as profile attributes. In this post, we describe a situation where there's form data with a wealth of metadata that resides merely as event attributes on Customer profiles. We will provide a solution that'll help you analyze this data, regardless of whether they're from recently submitted forms or the ones submitted in past.

Problem

In this example, approximately 1500 people performed a form_submit event with event attributes that were not ingested as profile attributes, and now this data needs to be accessed to update the profiles retroactively. However, currently there's no convenient way to export or utilize this form_submit event data from these historical submissions for retroactive analysis. 

Solution

The solution is two-fold. The first scenario handles future data, while the other is for 'form_submit' events that have already taken place. For future data, we can configure the system to update the attributes immediately when the form is submitted. This is achievable by visiting Data & Integrations > Integrations > Forms and mapping form fields to attributes as shown in this guide.

For past data, the best strategy is to update the profiles retroactively via a segment-triggered campaign that leverages our API Activities endpoint via a Webhook Action. By means of a webhook action, we can update the profiles that historically submitted the form in question. It's however important to note that only events that took place within the last 30 days can be retrieved through this endpoint for subsequent profile updates.

Lastly, it's also possible to get the event data and set it as attributes on the profile using our API endpoint.

Let’s look at an example of how this can be achieved. We have an event called employee_enrolled that we would like to retroactively retrieve data from. We created a data-driven segment to capture users that performed the event in the past 30 days:

Screenshot-2023-06-22-at-1-49-19-PM.png

Next, we use this segment to trigger a new campaign. Within the campaign workflow, we add a Webhook action to retrieve data from the Activities endpoint:


Screenshot-2023-06-22-at-1-50-49-PM.png

The Request tab uses the following configuration:

Customer-io-2023-06-22-at-1-51-48-PM.jpg


As the event is employee_enrolled, we use the following URL in our GET Request:

https://api.customer.io/v1/activities?type=event&name=employee_enrolled&customer_id={{customer.id}}



Our response looks something like this:
 

{
"activities": [
{
"id": "XXXXXXXXXXXXXXXXXX",
"customer_id": "1028",
"customer_identifiers": {
"cio_id": "87a70700d601d701",
"email": "person@customer.io",
"id": "1028"
},
"type": "event",
"timestamp": 1687361410,
"data": {
"employee_name": "Chandler Bing"
},
"name": "employee_enrolled"
}
],
"next": ""
}



On the Response tab, we set an attribute update for the full_name attribute to use the value of {{response.activities[0].data.employee_name}}:

Screenshot-2023-06-22-at-1-55-24-PM.png

Now when the campaign begins each user will have their activity event data checked for the specific event, and the profile attribute will be updated based on the response from the API.

 

Resources


0 replies

Be the first to reply!

Reply