# Customer.io Reference

## Destination Info

* Accepts [Page](https://documentation.freshpaint.io/developer-docs/freshpaint-sdk-reference#page), [Track](https://documentation.freshpaint.io/developer-docs/freshpaint-sdk-reference#track), [Group](https://documentation.freshpaint.io/developer/freshpaint-sdk-reference#group), and [Identify](https://documentation.freshpaint.io/developer-docs/freshpaint-sdk-reference#identify) calls
* Supports [HIPAA mode](https://documentation.freshpaint.io/hipaa-mode)
* Connection Modes:

<table><thead><tr><th width="100" align="right"> </th><th data-type="checkbox">Client-side</th><th data-type="checkbox">Server-side</th></tr></thead><tbody><tr><td align="right">Web</td><td>true</td><td>true</td></tr><tr><td align="right">Mobile</td><td>false</td><td>true</td></tr><tr><td align="right">Server</td><td>false</td><td>true</td></tr></tbody></table>

## Identify

When you call [identify()](https://documentation.freshpaint.io/readme/setting-up-identify), if the user already exists, Freshpaint will attach the provided user properties to the corresponding user as [Customer.io customer attributes](https://www.customer.io/docs/attributes/) by calling Customer.io's single request endpoint for their [track api ](https://customer.io/docs/api/track/#operation/identify)at endpoint: /api/v1/customers.

If the user does not exist, Freshpaint will create the user in Customer.io.

If your account supports both `email` and `id` as identifiers in Customer.io (**this is the default setting for accounts created after June 2021**), you can identify users using either one.&#x20;

<figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FKNSoBxk9IK3z6HOeKul5%2Fimage.png?alt=media&#x26;token=56a6da2c-bbc3-48a3-a474-a30d47bea069" alt=""><figcaption></figcaption></figure>

You can look at all the attributes collected with the user profile in Data & Integrations > Data Index.&#x20;

<figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FNw2I6B8pE3KrRhaPwWif%2FPasted%20Graphic%2026.png?alt=media&#x26;token=2594550c-220d-4f5b-83a0-79622dfe0eb9" alt=""><figcaption></figcaption></figure>

If you want to add a custom user property, you just have to add it into the $user\_props object in your identify. For example,

<pre><code><strong>freshpaint.identify("userId1234", {
</strong>  "token": "&#x3C;your_env_id>",
  "time": 1676399027,
  "distinct_id": "john.doe@example.com",
  "$device_id": "00000000-0000-0000-0000-00000000",
  "$user_props": {
    "firstname": "John",
    "lastname": "Doe",
    "customProp": 12345
  }
})
</code></pre>

### Unsubscribe Users

You can unsubscribe users in Customer.io by simply adding the unsubscribed: true key value pair to the identify call. For example,

```
freshpaint.identify("userId1234", {
    "email": "john.doe@example.com",
    "unsubscribed": true
  }
)
```

## Events

Freshpaint events will be sent to Customer.io as Customer.io [Events](https://www.customer.io/docs/events/) by hitting their [track API ](https://customer.io/docs/api/track/#tag/Track-Events)endpoint at: [https://track.customer.io/api/v1/customers/{identifier}/events](https://track.customer.io/api/v1/customers/%7Bidentifier%7D/events)&#x20;

{% hint style="info" %}
Make sure the [identify call ](https://documentation.freshpaint.io/readme/setting-up-identify)has gone out with either the email or id property prior to sending events to this destination. Anonymous events are only stored in Customer.io for 30 days.
{% endhint %}

You can send [anonymous events](https://www.customer.io/docs/anonymous-events/) to Customer.io containing an anonymous\_id. When you set the anonymous\_id on a person, we associate those anonymous events with a person. This lets you log events before people log in, sign up, or are otherwise identified, and then attribute those events to people after you identify them.

You can view all recent events in Customer.io's Activity Logs.&#x20;

<figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FJIEYa2p8keWoxqSTvcfP%2FPasted%20Graphic%2027.png?alt=media&#x26;token=dfe615fc-abe1-4cb4-9ec9-f50d6b1b3354" alt=""><figcaption></figcaption></figure>

### Turn on anonymous event merging

When you create a new workspace, anonymous event merging is on by default. If you created your workspace before July 2021, you must enable Anonymous event merging to associate anonymous events with people you identify.

1. Go to Settings > Workspace Settings.
2. Scroll down to Merge Settings and click Settings.

   <figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2F92uudQEURz5nVOdlRjSV%2FScreenshot%202022-09-15%20at%205.12.08%20PM.png?alt=media&#x26;token=3a35c454-e7af-4d2e-9315-8b1ef0641da6" alt=""><figcaption></figcaption></figure>
3. Turn on the *Anonymous event merge* setting.

   <figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2Fkcy4IEo4frBhYT7Tweqf%2FScreenshot%202022-09-15%20at%204.51.20%20PM.png?alt=media&#x26;token=145ac239-9782-40e1-8cce-9a072206a516" alt=""><figcaption></figcaption></figure>

### Pageviews

Freshpaint will automatically send all page view events to Customer.io. Page views show up in Customer.io [as events with the URL of the page as the name of the event](https://customer.io/docs/pageviews/).

<figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FipF7yrgbD7o1UATE3fdw%2FPasted%20Graphic%2028.png?alt=media&#x26;token=59328640-f536-4b86-80da-51361647d64f" alt=""><figcaption></figcaption></figure>

## Configuration Settings

### Connection Mode Settings

Both client side and server side connections modes are available for this destination. You can read more about connection modes [here](https://documentation.freshpaint.io/faqs/what-is-the-difference-between-client-side-and-server-side-connection-mode).

### Event Transformations

Set up transformations to modify your data before it's sent to your destination. Read more about transformations [here](https://documentation.freshpaint.io/data-management/transformations).

<figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FK6WG04hQZD1IMAfQFSjA%2Fimage.png?alt=media&#x26;token=ca652fec-4467-4521-9c88-cc347cf20479" alt=""><figcaption></figcaption></figure>

## Customer.io Limits

Customer.io has limits on the data collected by their track API. If you are using Freshpaint's[ HTTP API ](https://documentation.freshpaint.io/developer/http-api) to send a batch of events to Customer.io at once, make sure you throttle the `import` to 100-200 requests per second. Below are the payload size limits for their track API.

### User Limits

Customer.io limits user traits as listed below, referred to as Customers in Customer.io:

| Data Type         | Limit      | Description                                                  |
| ----------------- | ---------- | ------------------------------------------------------------ |
| ID                | 150 bytes  | Max length of a person's ID value                            |
| Attribute Name    | 150 bytes  | Max length of each attribute name                            |
| Attribute Value   | 1000 bytes | Max length of attribute values                               |
| Unique attributes | 300        | Max number of attributes allowed per person or Identify call |

See Customer.io's [documentation](https://customer.io/docs/api/track/#section/Track-API-Limits) for more information.

### Track API Event Rate Limits

| Data Type  | Limit        | Description                   |
| ---------- | ------------ | ----------------------------- |
| Event Name | 100 bytes    | Max length of each event name |
| Event Data | 100000 bytes | Max length of each event data |

See Customer.io's [documentation](https://www.customer.io/docs/api/track/#section/Track-API-Limits) for more information.
