You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Customer.io](https://customer.io/) helps you send automated email, push, SMS, and webhooks based on your customers' activities in your app or product. It makes conversion tracking, optimization and re-marketing easier. The `analytics.js` Customer.io Destination is open-source. You can browse the code [on GitHub](https://github.com/segment-integrations/analytics.js-integration-customerio).
9
+
10
+
> success ""
11
+
> **Good to know**: This page is about the Customer.io Segment destination, which receives data from Segment. There's also a page about the [Customer.io Segment source](/docs/connections/sources/catalog/cloud-apps/customer-io/), which sends data _to_ Segment!
12
+
13
+
14
+
## Getting Started
15
+
16
+
{% include content/connection-modes.md %}
17
+
18
+
You can follow the setup guide through Segment using the steps below, or you can automatically sync your Customer.io connection settings to your Segment source using the flow in your Customer.io workspace’s Integrations page.
19
+
20
+
1. From the Segment web app, click **Connections** > **Destinations**.
21
+
1. Search for “Customer.io”, select it, and then click **Configure Customer.io**.
22
+
1. Select the data sources you want to connect to Customer.io and click **Next**.
23
+
1. Enter your *Destination Name* and select your **Connection Mode**—Cloud Mode or Device Mode. Click **Save**.
24
+
1. Under *Connection Settings*, enter your Customer.io workspace **API Key** and **Site ID**. You’ll find both in your Customer.io *Account Settings* > *API Credentials* page.
25
+
26
+
If you want to sync your settings directly from your Customer.io workspace, go to **Settings** > **Integrations** and find the **Segment Destination** integration.
27
+
28
+

29
+
30
+
## Page
31
+
32
+
If you're not familiar with the Segment Specs, take a look to understand what the [Page method](/docs/connections/spec/page/) does. An example call would look like:
33
+
34
+
```javascript
35
+
analytics.page();
36
+
```
37
+
38
+
Page events send to Customer.io as a `Page View` event where names and properties are optional. In the Customer.io "Activity View", the event will have "Activity Type" set to "Page View" and "Activity Name" set to the page name. If there is no page name, "Activity Name" defaults to the page URL.
39
+
40
+
## Screen
41
+
42
+
If you're not familiar with the Segment Specs, take a look to understand what the [Screen method](/docs/connections/spec/screen/) does. An example call would look like:
43
+
44
+
```objc
45
+
[[SEGAnalytics sharedAnalytics] screen:@"Home"];
46
+
```
47
+
48
+
Screen events send to Customer.io as a custom event. In the Customer.io "Activity View", "Activity Type" is `event` and "Activity Value" sets to `Viewed {screen name} Screen`. For the earlier example the "Activity Value" will be `Viewed Home Screen`. If there is no screen name, then "Activity Value" will be `Viewed Undefined Screen`.
49
+
50
+
51
+
## Identify
52
+
53
+
If you're not familiar with the Segment Specs, take a look to understand what the [Identify method](/docs/connections/spec/identify/) does. An example call looks like this:
When you identify a new user, Customer.io adds the user to your Customer.io workspace. If the user exists, the identify request updates the existing person’s attributes.
62
+
63
+
If your Customer.io workspace supports both `email` and `id` as identifiers (the default setting as of June 2021), you can identify people either by a database identifier (called `id` in Customer.io) or the `email` trait.
64
+
65
+
This provides a path to identify people who enter your system as leads (by email) and then assign them an ID in Customer.io when they become a customer or user.
66
+
67
+
* If you don't have an ID, pass a person's email address as the `userId` in the identify call. Customer.io maps this value to a person's `email` attribute.
68
+
* If you have an ID, set the `userId` in the identify call to the person's ID and pass `email` as a trait. This sets both a person's `id` and `email` attributes in Customer.io. If you previously identified a person by `email`, your request updates that person and assigns them an `id`.
69
+
70
+
71
+
### Updating people
72
+
73
+
When Customer.io recognizes either the `id` or `email` in your request, your identify request updates that person.
If you want to change the `id` or `email` you've assigned a person in Customer.io, you have to pass a person's `cio_id`, in the format `cio_<cio_id value>` as the `userId` in your identify call. Currently, you must retrieve this value from a person's page in the Customer.io interface. In the future, you'll be able to do that using this call from Customer.io API.
To unsubscribe a user, simply pass `unsubscribed: true` in an identify call. Be sure the `id` and/or `email` values match the values in Customer.io. You can find these values in Customer.io by selecting a person on the _People_ page, and clicking _Attributes_. Here is an example that unsubscribes a user:
### Identifying people in workspaces that only support ID
104
+
105
+
In older workspaces, or workspaces using Customer.io's "classic" settings, you can only identify people by ID.
106
+
107
+
You do not need to pass an email address unless you want to send emails. If you want to send emails, you must provide the email address as a trait labeled `email`.
108
+
109
+
## Track
110
+
111
+
If you're not familiar with the Segment Specs, take a look to understand what the [Track method](/docs/connections/spec/track/) does. An example call would look like:
112
+
113
+
```javascript
114
+
analytics.track('Clicked Button');
115
+
```
116
+
117
+
Track events send to Customer.io as `custom events`. In the Customer.io "Activity View", "Activity Type" sets to `event` and "Activity Name" sets to the event name.
118
+
119
+
## Device Token Set up
120
+
121
+
Set `device.token` before you send the `Application Installed`, `Application Uninstalled`, or `Application Opened` events to Segment.
122
+
123
+
For that, you need to make the following calls:
124
+
125
+
- For Android, you need to make a call to `putDeviceToken` when Segment client initializes.
126
+
- Read [more here](/docs/connections/sources/catalog/libraries/mobile/android/#how-should-i-use-outbounds-push-notifications) for adding tokens for Android devices
127
+
- For iOS, you need to make a call to `segment.registeredForRemoteNotifications` when you receive the `didRegisterForRemoteNotificationsWithDeviceToken` event.
128
+
- Read [more here](/docs/connections/sources/catalog/libraries/mobile/ios/#how-do-i-use-push-notifications) for adding tokens for iOS devices
129
+
130
+
## Application Installed
131
+
132
+
[Application Installed](/docs/connections/spec/mobile/#application-installed) events will add or update a device in the person's Customer.io profile using [this](https://customer.io/docs/api/#apitrackcustomersdevices_update) API endpoint. Note, you must pass a device token in your event payload using a `context.device.token` property. See more on Contextual properties [here](/docs/connections/spec/common/#context).
[Application Opened](/docs/connections/spec/mobile/#application-opened) events will add or update a device in the person's Customer.io profile using the same endpoint as above. If a device already exists, Customer.io will update its `last_used_at` timestamp. Again, make sure you pass a device token in your event payload using a `context.device.token` property. See more on [Contextual properties](/docs/connections/spec/common/#context).
[Application Uninstalled](/docs/connections/spec/mobile/#application-installed) events will remove the device from the person's Customer.io profile using [this](https://customer.io/docs/api/#apitrackcustomersdevices_delete) API endpoint. Note, you must pass a device token in your event payload using a `context.device.token` property. See more on [Contextual properties](/docs/connections/spec/common/#context).
You can enable Customer.io as a Segment Source to send[ email events](/docs/connections/spec/email/) to other tools on the Segment platform. These events are sent as track calls to the other destinations you’ve turned on.
246
+
247
+
To enable this feature:
248
+
249
+
1. In Customer.io go to **Settings** > **Integrations**.
250
+
2. Find the Segment Source integration.
251
+
3. Add your _Segment Write Key_ and click **Connect Segment**.
252
+
253
+

254
+
255
+
## Best Practices
256
+
257
+
### Rate Limits
258
+
Customer.io has limits on the data collected by their API. To ensure your events arrive in Customer.io, make sure that you're respecting the limits placed on the [Customer.io API](https://learn.customer.io/api/#api-documentationlimits). If you're using Segment's [HTTP API](/docs/connections/sources/catalog/libraries/server/http/) to send a batch of events to Customer.io at once, make sure you throttle the `import` to 100-200 requests per second.
259
+
260
+
## Troubleshooting
261
+
262
+
### No Events in Customer.io from the Browser
263
+
Remember that before Segment can send events to Customer.io from client-side Javascript, the current user must identify with their `userId`. The user's email address is only used to identify them if that is the ID on record for them in Customer.io.
264
+
265
+
### Page events not associated with user
266
+
Page events will associate to a user if the user has been previously identified in Customer.io. If you identify a user after making Page calls, the previous page events won't associate to the user in Customer.io.
267
+
268
+
269
+
## Personas
270
+
271
+
You can send computed traits and audiences generated using [Segment Personas](/docs/personas) to this destination as a **user property**. To learn more about Personas, contact Segment for a [demo](https://segment.com/contact/demo).
272
+
273
+
For user-property destinations, an [identify](/docs/connections/spec/identify/) call sends to the destination for each user that's added and removed. The property name is the snake_cased version of the audience name, with a true/false value to indicate membership. For example, when a user first completes an order in the last 30 days, Personas sends an Identify call with the property `order_completed_last_30days: true`. When the user no longer satisfies this condition (for example, it's been more than 30 days since their last order), Personas sets that value to `false`.
274
+
275
+
> note ""
276
+
> Customer.io requires you to pass an identifier value (ID or email, depending on your workspace settings), when you sync Audiences or Computed Traits.
277
+
278
+
When you first create an audience, Personas sends an Identify call for every user in that audience. Later audience syncs only send updates for users whose membership has changed since the last sync.
[Customer.io](https://customer.io/) lets you send automated email, push, SMS, letters, and webhooks based on your customer's activities in your app or product. It makes conversion tracking, optimization and remarketing easier. The `analytics.js` Customer.io Destination is open-source. You can browse the code [on GitHub](https://github.com/segment-integrations/analytics.js-integration-customerio).
9
287
10
288
This document was last updated on January 26, 2018. If you notice any gaps, out-dated information or want to leave some feedback to help improve the documentation, [let us know](https://segment.com/help/contact)!
0 commit comments