Segment

Segment is a Customer Data Infrastructure (CDI) that lets you combine data across applications and platforms. Send Airship events to Segment for profile enrichment and event triggering (Airship as a source), and ingest external events from Segment with named users in Airship for message triggering, audience targeting, and analytics (Airship as a destination).

You can use the Source and Destination integrations together or separately.

Segment Integration Requirements

To get started, you must have accounts with both Segment and Airship. Your Airship account must include messaging.

  • Source integration: Your Airship account must include Real-Time Data Streaming.
  • Destination integration: No additional requirements.
 Note

Named User A customer-provided identifier used for mapping multiple devices and channels to a particular user. is not a requirement but is strongly recommended for mapping users across Segment and Airship. See: How To Implement Named Users.

Segment Source Integration

The Segment Source integration sends Airship events to Segment. First, you will add Airship to Segment as a source and retrieve your Write Key. Then you will create a Real-Time Data Stream integration for Segment in the Airship dashboard.

  1. Log in to your Segment workspace.
  2. Go to the Catalog.
  3. Find the Airship source and click Connect.
  4. Copy the Write Key. You will use this token when enabling your Segment integration in Airship.

Now you are ready to create the Segment Source integration in the Airship dashboard.

  1. In your messaging project, go to Settings » Real Time Data Streaming.
  2. Under Real-Time Data Streaming, click Segment.
  3. Provide a Name and Description for the integration.
  4. Enter the Segment Write Key that you copied when adding Airship as a source in Segment.
  5. (Optional) Select Include Anonymous Data if you want to send events that are not attributed to a named user to Segment. This can increase the number of customer profiles and the cost of using Segment.
  6. Select the event types that you want to send to Segment:
    • Opens
    • Closes
    • Custom Events
    • Screen Viewed
    • Location
    • Region
    • Sends
    • Control
    • Tag Changes
    • First Opens
    • First Opt-In
    • Uninstalls
    • Message Center Read, Delivery, and Delete Events
    • In-App Message Expiration, Resolution, and Display Events
    • Web Notification Session
    • Web Notification Click
    • Email Subscription
    • SMS Mobile-Originated
  7. Click Activate.

It may take several minutes to begin populating events in Segment. You can open the Airship source in Segment and use the Debugger option to see incoming data and confirm that your integration is working properly.

Segment Destination Integration

The Segment server-side Destination integration passes track events and identify attributes into Airship as custom events and tags.

Airship ConceptSegment Concept
Custom EventsTrack
TagsIdentify

Create Your Segment Tag Group

Segment attributes events to profiles. To properly feed events into and associate events with Segment profiles, named_user_id properties must map to Segment profile userId properties.

You can also set up Airship as a destination and feed information from Segment back into your Airship project. Airship supports track and identify calls from Segment.

  • track attributes custom events to named users in Airship.
  • identify sets tags for named users.

To take advantage of identify features, you must set up an Airship tag group called segment-integration.

See also: Manage Tag Groups.

  1. Open your messaging project and go to Settings » APIs & Integrations » Tag Groups.
  2. Click Create Tag Group and configure the fields.
    • Name: This name appears elsewhere in the dashboard, so choose something easily understandable and that describes the associated database, e.g., "Segment Integrations"
    • Description: The description should supplement the name, giving additional information about the tag group, if necessary. Be descriptive enough that anyone in your company would understand its source and purpose.
    • Group Key: Enter segment-integration. This permanent, unique ID is the text you will use when referring to your tag group in the API.
  3. (Optional) Enable Allow these tags to be set only from your server. This increases security for read-write operations, only allowing tags be read or changed by API calls authenticated with your master secret key.
     Note

    Without this security setting enabled, tags can be read and written from an app using only the application secret. Enabling this setting requires read-write operations to be validated with your master secret key or bearer token.

  4. Click Save.

Create an Access Token for the Airship API

The access token is used by Segment to communicate with your project in Airship. You must provide this token when enabling the Airship destination in Segment.

  1. In your messaging project, go to Settings » APIs & Integrations » Tokens.
  2. Click Create Token.
  3. Enter a token Name. This is just a friendly name to help you recognize your tokens in Airship.
  4. Select the All Access role.
  5. Click Create Token.
  6. Copy the values for App Key and Access Token, then click Got it to close the window.
     Warning

    You will not be able to view the Access Token after leaving this screen. You may, however, add new tokens and delete existing tokens. See: Manage Bearer Tokens.

Make Airship an Event Destination in Segment

When you add Airship as a destination, Segment adds tags to your named users in the segment-integration tag group and attributes custom events to named users.

  1. Log in to your Segment workspace.
  2. Go to the Catalog.
  3. Find the Airship destination and click Configure Airship.
  4. In the Select Source dialog, select a source and click Confirm Source.
  5. Enter the App Key and Access Token that you copied when setting up the Real-Time Data Streaming integration in Airship.
    • API Key: This is your Airship access token.
    • App Key: This is your Airship app key.
  6. Click Save.