Send data from Cordial to Segment – Cordial Knowledge Base

How can we help?

Overview

The Segment integration supports Cordial as a source, allowing you to send cross-channel engagement data from Cordial to Segment, where it can then be routed to any of Segment's integrations.

You can also send data from Segment to Cordial.

Event data

As events fire in Cordial, they are automatically sent directly to Segment. Each of the events below (along with all supporting metadata and contact identifiers) are included in the integration.

Cordial adheres to the Segment Spec: Semantic Events wherever applicable. The tables below show how Cordial events are mapped to the semantic event spec.

Email channel events

Cordial Segment
open Email opened
click Email link clicked
optout Unsubscribed
bounce Email bounced

Mobile channel events

Cordial Segment
crdl_app_install Application installed
crdl_app_open Application opened
crdl_notification_tap Push Notification Tapped
crdl_deep_link_open Deep Link Opened
crdl_notification_delivered_in_foreground Push Notification Received

SMS/MMS channel events

Cordial Segment
message_sent message_sent
click click

REST channel events

Cordial Segment
message_sent message_sent

Custom events

Cordial Segment

Enable and configure the Segment integration

You can enable and configure the Segment integration by following the steps below.

  1. Once you've created Cordial as a source in your Segment account, copy the Write Key.

  2. Log in to your Cordial account, navigate to Integrations > Partners, and select Enable on the Segment card.

  3. Click Edit in the Outbound Data Settings panel and then paste in your write key from your Segment source project.

  4. In the dropdown for each channel, choose to block or allow specific events, including your custom events. By default, Send all events is set for each case. When finished, click Continue.

In order to prevent recursion, any event records that are marked as having Segment as their origin source will automatically be blocked from being sent back to Segment.

Data examples

Example of a click event in Cordial (with nested objects and arrays)

{
  "action": "click",
  "time": "2021-10-22T16:11:48+0000",
  "bmID": "45:6172e28c897f2011ab137761:ot",
  "cID": "5c673e6b10986b7e3cd505d1",
  "mcID": "45:6172e28c897f2011ab137761:ot:5c673e6b10986b7e3cd505d1:1",
  "first": true,
  "lTags": [
    "threadsdemo"
  ],
  "_id": "6172e2c81815fd55160c82b1",
  "d": {
    "type": "computer",
    "device": "WebKit",
    "platform": "Windows",
    "browser": "Chrome",
    "robot": false,
    "bot_score": 18,
    "bot_verified": false,
    "asn": 701,
    "threat_score": 0
  },
  "properties": {
    "foo": "bar",
    "foo2": "bar2"
   },
  "system_properties": {
    "ed": "cordial.com",
    "mTags": [
      "test1",
      "test2"
    ],
  "link": "http://www.threads.com",
  "lKey": "http://www.threads.com",
  "rl": "http://www.threads.com?$utm_source=test1&utm_campaign=april1&utm_medium=test3"
  }
}

Example of a Cordial click event as passed to Segment (flattened)

Event records in Cordial contain nested objects of data. These objects are flattened when sent to Segment, following Segment's best practices. Also note, keys are added to the payload in adherence to the Semantic Event Spec. As an example: "campaign_id", "campaign_name","email_id", and "email_subject" are all added to the payload for email events. See the flattened example payload below.

{
  "anonymousId": "5c673e6b10986b7e3cd505d1",
  "context": {
    "library": {
      "name": "unknown",
      "version": "unknown"
    },
    "source": "cordial"
  },
  "event": "Email Link Clicked",
  "integrations": {},
  "messageId": "api-.....",
  "properties": {
    "_id": "6172e2c81815fd55160c82b1",
    "action": "click",
    "bmID": "45:6172e28c897f2011ab137761:ot",
    "cID": "5c673e6b10986b7e3cd505d1",
    "campaign_id": "45:6172e28c897f2011ab137761:ot",
    "campaign_name": "Fall Sale",
    "email_id": "45:6172e28c897f2011ab137761:ot:5c673e6b10986b7e3cd505d1:1",
    "email_subject": "Fall Sale 10% Off",
    "first": true,
    "link_url": "http://www.cordial.com?$utm_source=test1&utm_campaign=april1&utm_medium=test3",
    "mcID": "45:6172e28c897f2011ab137761:ot:5c673e6b10986b7e3cd505d1:1",
    "system_properties_ed": "cordial.com",
    "system_properties_mTags_0": "test1",
    "system_properties_mTags_1": "test2",
    "system_properties_lKey": "http://www.threads.com",
    "system_properties_rl": "http://www.threads.com?$utm_source=test1&utm_campaign=april1&utm_medium=test3",
    "properties_foo": "bar",
    "properties_foo2": "bar2",
    "lTags_0": "threadsdemo",
    "d_type": "computer",
    "d_device": "WebKit",
    "d_platform": "Windows",
    "d_browser": "Chrome",
    "d_robot": false,
    "d_bot_score": 18,
    "d_bot_verified": false,
    "d_asn": 701,
    "d_threat_score": 0
  },
  "receivedAt": "2021-10-22T16:11:53.270Z",
  "sentAt": "2021-10-22T16:11:53.000Z",
  "timestamp": "2021-10-22T16:11:53.540Z",
  "type": "track",
  "writeKey": "...."
}