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.
Segment as a platform supports 2 different connection modes with MoEngage. The most preferred one is the device mode integration which will enable all moengage capabilities for your mobile app and also forward all data to moengage directly from your mobile app.
For sending offline data to moengage, we recommend using the cloud mode integration.
More details for both are in the following sections.
Segment Device Mode Integration
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.
Segment Cloud Mode Integration
Cloud Mode Connection is used in the below cases -
You would need the Cloud Mode connection if you want to forward data to MoEngage generated by Segment's server side sources.
If you establish a connection between your Android / iOS source and MoEngage destination and MoEngage + Segment code is not bundled on a device, then Segment will send this data to MoEngage via Cloud Mode connection automatically.
Configuration on Segment
To setup MoEngage <> Segment connection, do the following:
- First get your key (AppID) from MoEngage dashboard.
- Go to Segment dashboard, then go to Integrations and select MoEngage.
- Enable MoEngage Integration.
- Go to MoEngage Settings and enter the MoEngage AppID, obtained in Step1.
- Save the changes.
- Make sure the Connection Mode is set to Device Mode. This is required in order to make use of features like push notification and in-app feature of MoEngage SDK. You would also need to update your app with client side integration.
These new settings will take up to an hour to propagate to all of your existing users. For new users it’ll be instantaneous!
Please note that Segment-MoEngage Integration is a bundled integration and requires client side integration.
APP ID : Get the App Id from your MoEngage account.
Enable Debug Logging : Switch it on if you want to enable debug logs. Switching it on will flow your data to TEST environment in MoEngage.
For Android, iOS sources, the default connection mode is Device mode.
For Server side sources, default connection mode is Cloud mode.
Which connection mode to choose?
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 -
For using MoEngage Push Notifications, InApp Messaging - you would need to install the MoEngage SDKs separately.
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.
If connection mode is cloud mode, you cannot use MoEngage functionalities like Real Time Triggers, On-site Messaging and Smart In-App Messaging.
Integration for Device Mode
Below are the steps to get started with Device Mode Configuration -
- Add the moengage dependency as per the source.
- Follow the documentation mentioned below -
Integration for Cloud Mode
For your server side sources, Cloud Mode is the default connection mode and you do not need to configure anything here.
There are some limitations while using Cloud Mode Integration -
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.
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.