Introduction
With the MoEngage Destination on Segment, you can forward your Users, Events, and Audiences (Segment Engage) to MoEngage and run personalized campaigns targeting them. Currently, MoEngage offers two modes of integration with Segment:
Integration mode | MoEngage Features |
---|---|
Side-by-side (Device mode) |
Device mode enables all MoEngage capabilities for your mobile app and also forwards all data to MoEngage directly from your mobile app. This is the preferred mode. |
Server-to-server (Cloud mode) |
Cloud mode is recommended for sending offline data to MoEngage. The following are not supported:
Note: Anonymous users and their events are supported only in the MoEngage (Actions) Destination. |
info |
Information To use MoEngage with Segment, we strongly recommend you go ahead with the Device Mode connection, as all our capabilities are supported with Device Mode. However, you would always need to use Cloud Mode to send data to MoEngage using your server-side sources and offline data. While MoEngage ingests data sent via Segment Cloud Mode connection, there are a few limitations with this approach as of now -
|
Based on your preferred mode of integration, we recommend using the following:
Integration mode | Destination Recommended |
---|---|
Side-by-side (Device mode) |
MoEngage (Classic) |
Server-to-server (Cloud mode) |
MoEngage (Actions) |
Integration
library_add_check |
Prerequisites
|
Step 1: Add MoEngage as the Destination
After your sources are successfully configured, you must establish MoEngage as a destination. The connection settings offer numerous ways to customize how data moves between MoEngage and Segment. To add MoEngage as the destination, perform the following steps:
- Log in to your Segment App.
- On the left navigation menu in the Segment dashboard, click Connections > Destinations.
- Click + Add Destination.
- Under Destinations, you can select MoEngage and MoEngage (Actions) based on your preferred destination.
MoEngage (Classic)
The MoEngage or “MoEngage (Classic)” Destination allows you to forward Users and Events from Segment using either Segment’s Device-mode or Cloud-mode. To set up MoEngage:
- On the MoEngage Destination page, Click Add Destination.
- Select Data Source and click Next.
- Based on your integration mode selected in Step 2, on the Setup page, enter the Destination name. Optional: If you previously integrated with the MoEngage destination, you can select to copy those settings here.
- Click Create Destination.
- On the Settings tab, enter the details of your MoEngage App and enable the connection to start forwarding data to MoEngage.
Step 2: Select the Integration type and Implement
The MoEngage (Classic) integration supports two connection modes for forwarding data from Segment to MoEngage:
- Device Mode (Side-by-side): This mode enables all MoEngage capabilities for your mobile app and forwards all data directly from your mobile app to MoEngage. This is the preferred mode.
- Cloud Mode (Server-to-server): This mode is recommended for sending offline data to MoEngage.
Device Mode (Side-by-side)
Device Mode is the preferred connection mode for using MoEngage with Segment. When configured with Device Mode, Segment forwards all track and identify requests directly to MoEngage via the user's device. This means your app makes separate requests to Segment and MoEngage, eliminating the need for you to explicitly send data to MoEngage. To use Device Mode on Android and iOS, integrate the MoEngage + Segment bundle. For your website data, select a Device Mode connection.
Under the Settings tab, enter the following details:
Entity | Description |
---|---|
App ID | To obtain your Workspace ID: Navigate to MoEngage Dashboard > Settings > General. |
Debug Logging | You must enable debug logs by turning on this option. This routes your data to the TEST environment in MoEngage. |
Connection Mode (You will see this option only for the JavaScript source) |
Website, Android, & iOS: The default connection mode is Device Mode. Server-side: The default connection mode is Cloud Mode. |
For using the device mode connection and leveraging all MoEngage capabilities, you would need to follow the integration steps mentioned below:
The MoEngage SDK you need to use will depend on which Segment SDK you use:
Segment SDK | MoEngage SDK | Preferred |
---|---|---|
Analytics Swift | For more information, refer to MoEngage Segment Swift | Preferred |
Analytics iOS | For more information, refer to MoEngage Segment iOS | Legacy |
The MoEngage SDK you need to use will depend on which Segment SDK you use:
Segment SDK | MoEngage SDK | Preferred |
---|---|---|
Analytics Kotlin | For more information, refer to MoEngage Segment Kotlin | Preferred |
Analytics Android | For more information, refer to MoEngage Segment Android | Legacy |
To complete the side-by-side integration, For more information, refer to Segment Web.
To complete the side-by-side integration, For more information, refer to Segment React Naive.
Cloud Mode (Server-to-server)
Cloud Mode integration is beneficial in the following scenarios:
- Forwarding data to MoEngage generated by Segment's server-side sources.
- Automatically sending data via Cloud Mode when the MoEngage + Segment code is not bundled on an Android or iOS device.
For more information, refer to Segment Sources, MoEngage Destination, and supported connection modes.
library_add_check |
Limitations A few limitations exist when using Cloud Mode integration: Segment transforms all your attributes (properties) from camelCase to snake_case before sending this data to MoEngage (only via Cloud Mode). This might result in duplicate attributes appearing on your MoEngage dashboard. This transformation does not occur when you use Device Mode. |
MoEngage (Actions)
MoEngage (Actions) Destination provides significant improvements over the Classic Destination:
Benefits of MoEngage (Actions) vs MoEngage Classic
MoEngage (Actions) provides the following benefits over the MoEngage Classic destination:
- Data Consistency: We have improved data consistency between Device Mode and Cloud Mode. Previously, data sent through these modes would sometimes be mismatched or contain duplicated properties; this issue is now resolved.
- Mapping Support: Using MoEngage Actions, you can now map properties that are previously incompatible with MoEngage-compatible properties. This significantly reduces your development bandwidth.
- Enhanced Configuration: Additional configurations are now available for the JavaScript integration, including the option for a custom Service Worker.
Step 2: Set up MoEngage (Actions) Destination
To set up the MoEngage (Actions) Destination, perform the following steps:
- On the Set up page, enter a Destination name.
Note: Select your preferred setup method. Optional: If you previously integrated with MoEngage, you can copy the settings from a previous destination. - Click Save.
- On the Settings tab, enter your MoEngage App details.
Entity Description Name This is the name of the MoEngage destination, such as MoEngage prod, MoEngage test, and so on. App ID Copy and paste the Workspace ID. The Workspace ID of your MoEngage account is available at Settings -> Account -> APIs -> Workspace ID.
The Data API ID and the Workspace ID of your MoEngage account are the same.
App Key Copy and paste the App Key. The Data API key of your MoEngage account is available at Settings -> Account -> APIs -> API keys > Data API settings. Endpoint region This is your MoEngage data center. For more information, refer here. - Turn the Enable Destination toggle on and then click Save Changes.
Enable mappings - Track and Identify
The MoEngage (Actions) Destination now supports Data Mapping. This allows you to control how Segment sends the event data it receives from your sources to MoEngage. Each Action within this destination lists its required and optional event data. You can also choose which event types, event names, or event property values trigger an Action.
These triggers and mappings enable you to send different versions of an Action, depending on the context from which it is triggered. For more information, refer to Classic Destinations and Destination Actions. To use mappings, click the Mappings tab > + New Mapping. The MoEngage (Actions) provides two Actions: Track Event and Identify User.
Add Identify User mapping
info |
Information MoEngage (Actions) supports importing both Registered and anonymous users via Cloud Mode. Make sure to pass at least one of the User IDs or anonymous IDs. |
- Click the Mappings tab and then click + New Mapping.
- On the Add mapping section, under Actions, select Identify User.
- Define the event triggers based on your requirements, or retain the default condition provided by MoEngage.
- Click Test Event. The segment attempts to fetch a recent event that matches your trigger conditions.
- In the Define mappings step, MoEngage provides preset values for all mappings.
- Scroll to the end of the page to optionally test your connection.
- After the configuration, click Save. Ensure these values remain unchanged.
Update Existing Users Only
When making an Identity call, you have the option to create new users in MoEngage. If you select the Update existing users only option and the forwarded user is not already present in MoEngage, a new user will not be created; only the properties of existing users will be updated. If the setting to create new users is set to Yes, only the properties of existing users will be updated. (The value true is implied by Yes.)
Add Track Event Action
To add the Track Event action, perform the following steps:
- Click the Mappings tab and then click + New Mapping.
- On the Add mapping section, under Actions, select Track Event.
- Define the event triggers based on your requirements, or retain the default condition provided by MoEngage.
- Click Test Event. The segment attempts to fetch a recent event that matches your trigger conditions.
- In the Define mappings step, MoEngage provides preset values for all mappings.
- Scroll to the end of the page to optionally test your connection.
- After the configuration, click Save.
Note: Ensure these values remain unchanged.
info Information
After the Identify User and Track Event mappings, the Enabled toggle is turned on. If not, enable them by turning the toggle in the Status column.
Migration from the classic MoEngage destination
warning |
Warning Segment's Analytics.js 2.0 Required MoEngage (Actions) Destination requires features found in Segment's Analytics.js 2.0. If you are using Web actions and have connected MoEngage (Actions) Destination to a JavaScript Source, upgrade your Analytics.js (provided by Segment) to ensure compatibility. |
Step 3: Test your integration
After your integration is configured, you must confirm that data is being sent to MoEngage correctly. First, perform some test actions in your app. Then, in the MoEngage dashboard, you can view your data in the recent events, segments, or analytics sections. To verify specific data, you can filter your users and events based on the custom event and attribute data.
Segment Replays
Segment Replay takes an archived copy of your Segment data and resends it to MoEngage. With this, you can import all historical data from Segment to MoEngage. For more information, contact your Segment CSM related to Segment Replays.
Segment Engage and Computed Traits
Using Segment Engage, you can create segments of users based on data you have already collected across various sources and sync them to MoEngage. For more information, refer to how to set up and sync Segment Personas and Computed Traits.