Segment

Value: this field is optional. If you would like to create an sum or average metric, be sure to send this field.

Segment allows you to easily manage integrations with multiple analytics services. By tracking events and users via Segment’s API and libraries, you can send your product’s data to all of your analytics/marketing platforms, with minimal instrumentation code. They offer support for most platforms, including iOS, Android, JavaScript, Node.js, PHP, and more.

Use this integration to:

(1) send data from the Split platform as a source in Segment

  • When configured Split will send traffic impression data for splits to Segment.

(2) send data to the Split platform as a destination in Segment.

  • When configured, Split will quickly process and display in the Split platform for analysis. Split supports the identify, group, track, page and screen specs. Split and Segment let you change these integration settings via your Segment and Split dashboards without having to touch any code.

This documentation provides additional details on the different types of Segment integrations you can use, how they affect your data in Split, and instructions for setting up the integration.

If you use both the anonymousId and userId field on Segment's track call to differentiate between logged in and anonymous traffic, reach out to support@split.io for further guidance on how to best set up this integration.

Split as a Source

In Segment

  1. Add new HTTP API source. (Segment docs can be found here)
  2. Complete Name.
  3. Copy the write key provided for this new source.

In Split

  1. Go to Admin Settings and click Integrations and navigate to the Marketplace. Click Add next to Segment.
  2. Select the environments from where you would like data sent.
  3. Select how you would like to identify the impression in Segment.
  4. Paste the write key you copied in step 3 above and click Save.

As you can see from above, if you have different Split environments that correspond to different Segment workspaces, you can click on Add configuration to configure the integration to send with a different Write Key.

When configured properly, data will begin flowing in Segment as a track type with the event name get_treatment as shown below.

Split as a Destination

In Split

  1. Go to Admin Settings and click Integrations and navigate to the Marketplace. Click Add next to Segment.
  2. Under Track & Identify from Segment click add configuration.
  3. Configure the below fields:
    • Split environment: Select the environment in Split to where data should be sent.
    • Segment identity: Select which Segment identity should be used when mapping Segment identities to Split traffic types. (Either Segments User ID or Anonymous ID)
    • Split traffic type: Select which Split traffic type you would like Segment data mapped to when sent to Split.
    • Enable identify: When enabled, identities captured in Segment will be mapped to the traffic type you selected above and then be displayed in Split.
    • Enable track: When enabled, events captured in Segment will be sent to Split. Map your event data using the field mapping below.
      • eventTypeId: this field can be customized, but is most likely maps to the event field in the segment track call.
      • Value: this field is optional. If you would like to create a sum or average metric, be sure to send this field.
    • Track named pages: Track events to Split for page method calls that have a name associated with them. E.g. page(‘signup’) translated to view_signup_page.
    • Track named screens: Tracks events to Split for screen method calls that have a name associated with them. E.g. screen(‘signup’) translated to viewed_signup_screen.
  4. Once you’ve configured the above fields, click Save.
  5. Your integration is now configured. Copy the Webhook URL and Secret provided.

In Segment

  1. Select the source you’d like to send data from to Split.
  2. Click add destination and select webhooks. (Segment docs on this can be found here)
  3. Paste the webhook URL provided from Split within Segment in the webhook URL field.
  4. Paste the secret provided from Split within Segment under Headers as an Authorization.
  5. Click save.

Segment Spec Details

Identify

The identify call lets you tie a user to their actions and record traits about them. When you enable in Split and call the identify function, Segment will pass that id’s information to Split with userId (or anonymousId) as the Split traffic type you selected when configuring the integration. Traits are mapped to traffic type attributes in Split. Learn more about attributes in Split here.

Read more on Segment’s Identify spec here.

Track

The track call lets you record any actions your users perform, along with any properties that describe the action. When you enable in Split and call the track function Split will record events within Split. Learn more about Split’s events here.

Read more on Segment’s Track spec here.

Page

The page call lets you record whenever a user sees a page of your website, along with any optional properties about the page. When you enable in Split and call the page function Split will record events for page method calls that have a name associated with them. E.g. page(‘signup’) translated to view_signup_page.

Read more on Segment’s Page spec here.

Screen

The screen call lets you record whenever a user sees a screen, the mobile equivalent of page, in your mobile app, along with any properties about the screen. When you enable in Split and call the page function Split will record events for screen method calls that have a name associated with them. E.g. screen(‘signup’) translated to view_signup_screen.

Read more on Segment’s Screen spec here.

Group

The group spec allows you associate an individual user with a ‘group’ of users. Split associates a ‘group’ with the particular traffic type you configure. Learn more about using the group methods in the advanced functionality below.

Read more on Segment’s Group spec here.

Advanced Functionality

Setting event-level groups via .track()

To support mapping events across multiple traffic types (e.g. fire a track event for a user and an account), Split supports setting event-level groups. The group designation only applies for the specific event being logged. To specify these groups, provide an integration-specific property with key-value pairs corresponding to traffic type name in Split and the ID of the customer in Split. An example call would look like:

{
  "anonymousId": "23adfd82-aa0f-45a7-a756-24f2a7a4c895",
  ...
  "messageId": "ajs-f8ca1e4de5024d9430b3928bd8ac6b96",
  "properties": {
        "split": [{
            "account": "4d3405a0-9ca5-11e5-9706-16a11fb02dec" ## Customer ID
        }],
 ...
  "type": "track",
  "userId": "41e51150-6825-11e8-9f57-0acd31e5aef0",
  "originalTimestamp": "2015-12-12T19:11:01.152Z"
}

Identifying additional traffic types in Split via .group()

To support identifying multiple traffic types (e.g. identifying accounts), Split supports the ability to identify multiple traffic types within Split via Segment’s group method. To specify these groups, provide an integration-specific trait with key-value pair corresponding to traffic type name in Split and the id of the customer in Split you would like to identify. If split is able to identify a Split traffic type in the traits, all additional traits will be created as attributes of the traffic type and the values mapped to the customer id provided.

{
  "anonymousId": "23adfd82-aa0f-45a7-a756-24f2a7a4c89",
  ...
  "messageId": "022bb90c-bbac-11e4-8dfc-aa07a5b093db",
  ...
  "traits": {
     "split": {
           "account": "4d3405a0-9ca5-11e5-9706-16a11fb02dec" ## Customer ID
         },    
     ...
     }
  "type": "group",
  "userId": "7f244b10-9ca5-11e5-9706-16a11fb02dec",
  "groupId": "4d3405a0-9ca5-11e5-9706-16a11fb02dec",
  ...
}

FAQs

What happens if the eventTypeId field has spaces in Segment?

If the name has a space, Split will replace the space with an underscore taking "sample event" to "sample_event" when it appears in the Split web console.

What happens if the eventTypeId field isn’t mapped correctly, what does Split do?

If name doesn’t map or incorrectly does not match the configuration settings, the event will be dropped since this field is required.

What happens if the eventTypeId field is mapped correctly, but the value field isn’t mapped correctly, what does Split do?

If eventTypeId is mapped correctly but the value field does not align with the configuration settings, the value field will be null in Split as this field is optional.

What will happen in Split if we have traits.company in our identify call?

Passing traits.company will be received as a string version of the object in Split as an attribute “company”. We recommend flattening the object if you would like to see this data in Split.

What size limits does Split have on trait values?

Trait values must be no longer than 255 characters.