Segment

Segment is the single platform that collects, translates, and routes your user data to hundreds of analytics & marketing tools with the flip of a switch. By integrating Segment with Journey Analytics you can track events using the Segment APIs from any source and save them to your Journey Analytics project, in addition to or instead of using Journey Analytics's SDKs or APIs.

Segment integration with Journey Analytics works via Amazon Kinesis. Integrating Segment with Cooladata allows you to stream event data via Amazon Kinesis in addition to, or instead of using Journey Analytics's SDKs or APIs.

Settings up a Segment integration

  1. Set up an Amazon Kinesis integration, as explained here.
  2. In your Segment account, set up a new Amazon Kinesis source. You will need the following details:
    1. AWS User access KEY ID
    2. AWS Kinesis Stream Regio: use "us-east-1"
    3. AWS user secret access KEY
    4. AWS Stream kinesis name
  3. Click "Activate integration"

For more information on Segment's integration with Amazon Kinesis see Segment's documentation.

Kinesis screen

Kinesis setup dialog

APIs

Journey Analytics supports the following Segment APIs:

  • Identify
  • Track
  • Page
  • Screen

For more information on the various Segment APIs see Segment's documentation.

Event structure

Segment events are slightly different from Journey Analytics events. Segment events use nested JSON, and have different property names than Journey Analytics . When integration Segment and Journey Analytics , Journey Analytics flattens these event Segment property names are mapped to Journey Analytics properties.

JSON Flattening:

When a Segment event contains a nested JSON, it will be flattened using the standard JSON format. For example:

{a:{b:"value"}}

will be converted to

{a.b:"value"}

Thus, the property name of this key will be "a.b".

Property Mapping

Segment property names are mapped to Journey Analytics properties according to the following table. Where more than one Segment property can apply, the priority matches the order in the table.

Segment PropertyJourney Analytics Property
user_idproperties_UserIduser_iduserIdanonymous_idanonymousId
user_alternative_idanonymous_idanonymousId
event_nameeventtype
event_server_time_tstimestampreceived_atreceivedAt
event_client_time_tssent_atsentAt
session_ipcontext_ip
session_ip_countrycontext_locale
session_app_idcontext_app_name
session_brandcontext_device_name
session_modelcontext_device_model
session_os_versioncontext_os_version
session_oscontext_os_name
tracker_typecontext_library_name
tracker_versioncontext_library_version
utm_campaigncontext_campaign_name
utm_contentcontext_campaign_content
utm_mediumcontext_campaign_medium
utm_sourcecontext_campaign_source
utm_termcontext_campaign_term
session_duacontext_userAgent