Amplitude

You can use Segment to translate and forward data about how your audience receives and responds to your emails to Amplitude.

How it works

You’ll set up Customer.io as a Segment Source and Amplitude 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 Amplitude.

flowchart LR a[Customer/User]-->|opens/clicks
message|b((Customer.io)) b-->|Send message|a b-->|Reporting webhook|c[Segment] c-->|transforms
data|d[Amplitude]

 You can also integrate Customer.io with Amplitude 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 Amplitude. This kind of integration is generally unnecessary if you already use Amplitude’s JavaScript SDK.

Set up your integration

To set up this integration, you’ll need to:

  1. Set up Customer.io as a Segment Source.
  2. Add Amplitude 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.

  1. In Segment, Go to Connections, click Add Source, and select Customer.io.

  2. 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.

    Segment Sources setup
    Segment Sources setup

  3. On the Overview page, copy your Write Key.

    Segment Sources write key
    Segment Sources write key

  4. 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.

  5. Paste your Write Key in the field and click Connect Segment.

  6. Enable the events you want to send from Customer.io to Segment.

    Select events to send to segment
    Select events to send to segment

  7. When you’re ready, set up your Amplitude Destination in Segment.

Set up your Amplitude Destination

To set up a Amplitude destination, you’ll need your Amplitude API Key and Secret Key. You can find these values in Amplitude by clicking your project name under Settings > Projects.

These instructions focus on Segment’s Destination Actions integration. You can use the classic Amplitude destination, but it is in maintenance mode and will eventually be deprecated. See Segment’s Amplitude Destination Actions page for more information about this integration and how to map data from Segment to Amplitude.

  1. In Segment, go to Destinations and click Add Destination.
  2. Find and select Amplitude (Actions) in the Destinations Catalog.
  3. Click Configure Amplitude.
  4. Enter a friendly Name for the destination.
  5. Select the sources that you want to connect to your Amplitude destination.
  6. Copy your API Secret and Token from Amplitude into the appropriate fields in Segment.
    Set up your Amplitude integration
    Set up your Amplitude integration
  7. Enable the destination when you’re ready. This integration provides flexibility to Filter and change Mappings for your data. If you want to limit or modify the way your data maps to Amplitude, you should do that before you enable the integration.

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, might help you understand the contents of these events and what kind of information you can gather in Amplitude.

{
  "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"
}
Copied to clipboard!
Is this page helpful?