Mixpanel
You can use Segment to translate and forward data about how your audience receives and responds to your emails to Mixpanel.
How it works
You’ll set up Customer.io as a Segment Source and Mixpanel as a Segment Destination. Customer.io sends reporting webhooks for emails as track
calls, helping you gather information about the messages you send, and your audience’s responses to those messages—whether they open, click, unsubscribe, etc—in Mixpanel.
message|b((Customer.io)) b-->|Send message|a b-->|Reporting webhook|c[Segment] c-->|transforms
data|d[Mixpanel]
You can also integrate Customer.io with Mixpanel using analytics.js
Segment provides analytics.js, a library that you can use as a middle layer to forward Customer.io-formatted data from your website to Mixpanel. This kind of integration is generally unnecessary if you already use Mixpanel’s JavaScript SDK.
Set up your integration
To set up this integration, you’ll need to:
- Set up Customer.io as a Segment Source.
- Add Mixpanel as a Segment Destination and map source(s) to it.
Set up Customer.io as a Segment Source
To enable Customer.io as a Segment source, you need both a Customer.io and a Segment.com account. If you need to create a new Segment account, enter “Customer.io” in the How Did You Hear About Us? field.
We send anonymous events for people who do not have an ID
If a person has an ID, we send events with the ID as the Segment userId
. If a person has an email address but does not have an ID, we send events with an empty userId
and the email address as anonymousId
.
In Segment, Go to Connections, click Add Source, and select Customer.io.
Give your source a Name and a Label, and click Add Source. The Name helps you identify your source in Segment, and the Label helps you organize sources.
In your Customer.io workspace, go to Data & Integrations > Integrations and click the Segment Source integration. You can find it in the Data Management category.
Paste your Write Key in the field and click Connect Segment.
Enable the events you want to send from Customer.io to Segment.
When you’re ready, set up your Mixpanel Destination in Segment.
Set up your Mixpanel Destination
To set up a Mixpanel destination, you’ll need your Mixpanel API Secret and Token. You can find these values in your Mixpanel Project Settings. See Segment’s Mixpanel Destination page for more information about this integration and how Segment shapes data for Mixpanel.
- In Segment, go to Destinations and click Add Destination.
- Find and select Mixpanel in the Destinations Catalog.
- Select the sources that you want to connect to your Mixpanel destination.
- Copy your API Secret and Token from Mixpanel into Connection Settings in Segment.
- (Optional) Review your integration settings. Segment provides a number of settings determining how to handle incoming data.
- Enable the destination.
Your Customer.io source(s) can now send data into Segment.
How we map people to Segment
Our Segment Source integration maps a person’s id
in Customer.io to userId
in Segment.
If your Customer.io workspace supports both email
and id
as identifiersThe attributes you use to add, modify, and target people. Each unique identifier value represents an individual person in your workspace., people in your workspace can have an email
but not an id
. In this case, we use a person’s email
as their anonymousId
in Segment.
For more information about identifying people, see Segment’s Identify API.
analytics.track("New Lead", {
anonymousId: "peter@example.com"
name: "Peter Gibbons",
email: "peter@example.com"
});
analytics.track("New Customer", {
userId: "97980cfea0067",
name: "Peter Gibbons",
email: "peter@example.com",
plan: "premium"
});
Track calls
When you enable the Customer.io Segment Source integration, we send our reporting webhooks to Segment in their track
format. The following Email Delivered
event, formatted as it appears in Segment, may help you understand the contents of these events and what kind of information you can gather in Mixpanel.
{
"context": {
"integration": {
"name": "customer.io",
"version": "1.0.0"
},
"library": {
"name": "unknown",
"version": "unknown"
},
"traits": {
"email": "cool.person@example.com"
}
},
"event": "Email Delivered",
"integrations": {
"Customer.io": false
},
"messageId": "api-1u21CJeZPJX3TdLhPNrzstyAYZa",
"originalTimestamp": "2021-06-16T13:04:06Z",
"properties": {
"action_id": "n16",
"action_name": "Test Name",
"campaign_id": 1,
"campaign_name": "Test Name",
"delivery_id": "dgP6xQb6xQYDAAF6FOl-vmR0E7zoPqTRiAo=",
"email_id": "dgP6xQb6xQYDAAF6FOl-vmR0E7zoPqTRiAo=",
"email_subject": "Test Subject"
},
"receivedAt": "2021-06-16T13:05:39.605Z",
"sentAt": "2021-06-16T13:05:39.000Z",
"timestamp": "2021-06-16T13:04:06.605Z",
"type": "track",
"userId": "cool-person"
}