The Sample Moe Developer Hub

Welcome to the Sample Moe developer hub. You'll find comprehensive guides and documentation to help you start working with Sample Moe as quickly as possible, as well as support if you get stuck. Let's jump right in!

Search results for "{{ search.query }}"

No results found for "{{search.query}}".

iOS Integration

Integrating MoEngage with Segment in iOS

Installing SDK

MoEngage can be integrated via Segment using Cocoapods.

  • Initialise pod with pod init command, this will create a podfile for your project.
  • Update your podfile by adding pod 'Segment-MoEngage'.
  • Update the pod. - pod update

Setup Segment SDK

Now head to the the App Delegate, and setup the Segment SDK :

#import <SEGMoEngageIntegrationFactory.h> // This line is key for MoEngage integration
#import <SEGAnalytics.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  // Add your configuration key from Segment
    SEGAnalyticsConfiguration *config = [SEGAnalyticsConfiguration configurationWithWriteKey:@"configuration key"];
  // Add MoEngageIntegrationFactory. Without this data will not come to MoEngage.
    [config use:[SEGMoEngageIntegrationFactory instance]];
    [SEGAnalytics setupWithConfiguration:config];


Don't miss to add [config use:[SEGMoEngageIntegrationFactory instance]] while setting up Segment SDK. Unless this is done data will not be sent to MoEngage.

Setup MoEngage

To setup MoEngage do the following :

  1. First get your key(AppID) from MoEngage dashboard.
  2. Go to Segment dashboard, go to Integrations and select MoEngage.
  3. Enable MoEngage Integration.
  4. Go to MoEngage Settings and enter the MoEngage AppID, obtained in Step1.
  5. Save the changes.

These new settings will take up to an hour to propogate to all of your existing users. For new users it’ll be instanteneous! Segment-MoEngage Integration is a bundled integration, requires client side integration.
Check the following link for more information.

Tracking User Attribute

User attributes are specific traits of a user, like email, username, mobile, gender etc. identify lets you tie a user to their actions and record traits about them. It includes a unique User ID and any optional traits you know about them.

[[SEGAnalytics sharedAnalytics] identify:@"a user's id"
                                traits:@{ @"email": @"a user's email address" }];

For more info refer to this link.

Tracking Events

Event tracking is used to track user behaviour in an app. track lets you record the actions your users perform. Every action triggers i.e,“event”, which can also have associated attributes.

[[SEGAnalytics sharedAnalytics] track:@"Item Purchased"
                           properties:@{ @"item": @"Sword of Heracles",@"revenue": @2.95 }];

That's all you need for tracking data. For more info refer this link.

iOS Integration

Integrating MoEngage with Segment in iOS