Skip to content

MoEngage Analytics Implementation

What you'll learn

  • Generating the MoEngage vendor implementation
  • Completing the required native-level SDK setup
  • Configuring your App ID via app_config and registering the module

Prerequisites

  • Analytics SDK installed in your monorepo
  • A MoEngage account — copy your App ID from the MoEngage dashboard → Settings → App Settings
  • Native SDK configured for Android and iOS (see Step 2)

Step 1: Generate the Brick

bash
archipelago generate moengage_analytics_impl

You will be prompted for:

  • appNameMyApp (must match your monorepo app name)
  • isForMonorepotrue

The brick is generated into infrastructure/moengage_analytics_impl/.

Step 2: Complete Native SDK Setup

Important: MoEngage requires native-level initialisation that cannot be done from Dart alone. Follow the official guide before proceeding: MoEngage Flutter SDK Setup

This covers adding the MoEngage dependency to your android/build.gradle and ios/Podfile, and calling the platform-level initialize() in MainActivity / AppDelegate.

Step 3: Add the App ID to app_config

Open your app_config package and add the App ID to AppEnv:

dart
// lib/src/app_env.dart
class AppEnv {
  // existing fields …
  final String moengageAppId;   // from MoEngage → Settings → App Settings
}

Populate the value for each environment (dev, staging, prod).

Step 4: Register the Module and Verify

dart
import 'package:moengage_analytics_impl/moengage_analytics_impl.dart';

await initMoEngageAnalyticsImplModule(getIt);

The implementation is registered as @Named(AnalyticInjectorKey.moEngageImpl) and is picked up automatically by the analytics_sdk orchestrator via getIt.getAll<AnalyticVendor>().

Key behaviours to know:

  • Event parameters — built with MoEProperties using addAttribute(key, value).
  • User IDidentifyUser(userId) is called when you call setUserId.
  • User properties — set via setUserAttribute(key, value).
  • Logoutlogout() is called to reset the identity.

Trigger a tracked event and verify it appears in the MoEngage dashboard → Analytics → Event Analytics.

Next Steps

Built by Banua Coder