Overview

Introduction

Segment  is a customer data platform that helps you collect, clean, and activate your customer data.

If you are already using Segment for tracking data then the Segment - MoEngage Integration makes it extremely easy for you to send your event and attribute data to MoEngage.

Once you've tracked your data through Segment's source libraries, Segment will translate this and route your data to MoEngage in the format MoEngage understands so that you can save some of your engineering efforts for using MoEngage. Learn more about how to use MoEngage with Segment.

Scope

The MoEngage and Segment integration allows you to track your users and route data to a wide variety of user analytics providers. Segment allows you to:

  • Import data across two platforms. We offer a side-by-side (device mode) SDK integration for your Android, iOS, and web applications and a server-to-server integration for your backend services.
  • Send campaigns data to segment using MoEngage Streams
  • Sync Segment Personas (cohorts) to MoEngage for use in MoEngage segments and campaigns. 

Integration

The Segment Integration with MoEngage consists of two parts:

1. Data Sync from Segment to MoEngage:

Segment to MoEngage integration allows you to export user data in Segment to MoEngage and send personalized campaigns to all the users from MoEngage. 

 

 

PREREQUISITES

  • Login credentials for MoEngage and Segment.
  • Installed source and Segment source libraries - The origin of any data sent into Segment, such as mobile apps, websites, or backend servers. You must install the libraries into your app, site, or server before being able to set up a successful Source > Destination flow.

 

Step 1: Configure MoEngage settings in Segment

Once you add the Segment-MoEngage library to your app, you can enable MoEngage from the Segment App. These new settings can take up to an hour to propagate to your existing users. For new users, it’ll be instantaneous. 

To setup MoEngage do the following :

  1. First get your key(AppID) from the MoEngage dashboard.
  2. Go to your Segment workspace, go to Destinations and select MoEngage.
  3. Enable the MoEngage Destination.
  4. Go to the MoEngage Settings and enter the MoEngage AppID, obtained in Step1.
  5. Save the changes.
Entity Description
APP ID Get the App Id by navigating to Navigate to MoEngage Dashboard > Settings > General
Debug Logging Switch it on if you want to enable debug logs. Switching it on will flow your data to TEST environment in MoEngage

Connection Mode

(You will see this option only for the JavaScript source)

Android & iOS: Default connection mode is Device mode Server side: Default connection mode is Cloud mode

Step 2: Choose integration type and implement

The MoEngage <> Segment Integration supports the following -

  • Segment -> MoEngage Data Integration:
    With this integration mode, Segment will forward the data collected from your sources to MoEngage automatically. The data points that will be forwarded to MoEngage are Events and User Properties.

    Segment <> MoEngage integration supports two different connection modes for forwarding the data from Segment to MoEngage -
    • Device Mode (Side by side)- Device mode enables all MoEngage capabilities for your mobile app and also forward all data to MoEngage directly from your mobile app. This is preferred mode. 
    • Cloud mode (Server to server) - Cloud mode is recommended for send offline data to MoEngage.  

More details on each type of integrations is covered in the next sections.

Device Mode (side by side)

This is the preferred connection mode for using MoEngage with Segment. With the device mode connection, segment will forward all track and identify requests to MoEngage directly via the user's device. Here, your app will make separate requests to Segment and MoEngage without you having to send data to MoEngage explicitly.

Please ensure that you are integrating the MoEngage + Segment bundle if you want to use Device Mode on Android and iOS and ensure that you are selecting Device Mode connection for your website data.

Connecting MoEngage Destination for Android and iOS Source -

Screen_Shot_2021-06-25_at_2.01.58_PM.png

After saving the MoEngage destination, enter your MoEngage App Id which is available on *MoEngage Dashboard -> Settings -> App -> General* here -

Screen_Shot_2021-06-25_at_2.01.21_PM.png

Connecting MoEngage Destination for JS Source -

Screen_Shot_2021-06-25_at_2.00.44_PM.png

After saving the MoEngage destination, enter your MoEngage App Id which is available on *MoEngage Dashboard -> Settings -> App -> General* here -

Screen_Shot_2021-06-25_at_2.00.58_PM.png

For using the device mode connection and leveraging all MoEngage capabilities, you would need to follow the integration steps mentioned below: 

  1. Add the moengage dependency as per the source.
  2. Follow the documentation :
iOS Android Web
To complete the side-by-side integration, please refer to Segment’s detailed instructions for iOS

 

Cloud Mode (side by side)

Cloud Mode integration is beneficial in the following scenarios-

  1. Forward data to MoEngage generated by Segment's server side sources.
  2. For the connection between your Android / iOS source and MoEngage destination, the MoEngage + Segment code is not bundled on a device, then Segment will send this data via Cloud Mode connection automatically.

You can refer Segment documentation for more information on Segment sourcesMoEngage destination and supported connection modes.

  Limitations

There are some limitations while using Cloud Mode Integration -

1. Segment will transform all your attributes (properties) from camelCase to snake_case before sending this data to MoEngage (only via Cloud Mode). This may result in you seeing multiple attributes listed on your MoEngage dashboard. Such transformation does not happen when you are on Device Mode.

2. MoEngage can only track data of logged in users via Cloud Mode. Logged in users are all users for whom a user_id is available in segment. For users and requests without a user_id, MoEngage will reject the requests.

 

Step 3: Test your integration

You can view your data in the recent events, segments, or analytics sections. MoEngage allows you to filter your users based on the custom event and attribute data.

 

2. Streaming MoEngage Events to Segment

MoEngage to Segment integration allows you to export the campaign interaction events generated after your users engage with the MoEngage campaigns to Segment. To setup this integration, follow the below steps -

  1. Add an HTTP source in Segment - https://segment.com/docs/connections/sources/#http
  2. Once you have setup HTTP source in Segment, please get the data flow enabled by writing to your MoEngage account manager or to our support team at support@moengage.com
  3. Please include the Write key of your HTTP source in your email to MoEngage team as we would need this to authenticate our event requests to Segment.

Once we have enabled the data export integration from MoEngage, you should start seeing the campaign events generated by MoEngage in Segment and all destinations connected to your HTTP source in Segment.

The data points sent to Segment from MoEngage are available here.

 

Which connection mode to choose?

To use MoEngage with Segment, we strongly recommend you to go ahead with the Device Mode connection as all our capabilities are supported with Device Mode. For sending data to MoEngage via you server side sources, you would always need to use Cloud Mode.

While MoEngage ingests data sent via Segment Cloud Mode connection, there are a few limitations with this approach as of now -

1. For using MoEngage Push Notifications, InApp Messaging - you would need to install the MoEngage SDKs separately.

2. As of now, MoEngage only accepts data via Cloud Mode if the User Id is present. If the User Id is not present, the data will be rejected by MoEngage Cloud Destination.

3. If connection mode is cloud mode, you cannot use MoEngage functionalities like Real Time Triggers, On-site Messaging and Smart In-App Messaging.

Was this article helpful?
0 out of 0 found this helpful