Leanplum is a popular mobile marketing and customer engagement platform. It allows you to boost customer engagement and thereby drive retention, better conversion and increased business revenue.

RudderStack allows you to configure Leanplum as a destination and send your event data to it directly.

Find the open source transformer code for this destination in the GitHub repository.

Getting started

To enable sending data to Leanplum, you will first need to add it as a destination to the source from which you are sending your event data. Once the destination is enabled, events from our SDK will start flowing to Leanplum.

Before configuring your source and destination in RudderStack, please verify if the source platform is supported by Leanplum, by referring to the table below:

Connection ModeWebMobileServer
Device mode-Supported-
Cloud mode---
To learn more about the difference between cloud mode and device mode in RudderStack, refer to the RudderStack Connection Modes guide.

Once you have confirmed that the platform supports sending events to Leanplum, perform the steps below:

  • From your RudderStack dashboard, add the source. From the list of destinations, select Leanplum.
  • Give a name to the destination and click Next. You should then see the following screen:
image  32   1   1   1   1 Leanplum Connection Settings in RudderStack
  • Enter the Leanplum Application ID as well as Client Key.
  • Click Next to complete the configuration.

Leanplum should now be added and enabled as a destination in RudderStack.

If you choose to keep the Use in Development Environment flag as on, then please put your developmentKey in the Client Key field. Failing to do so will result to faulty initialization of the SDK and events will not be passed.

Adding Leanplum to your project

Depending on your platform of integration, follow these steps below to add Leanplum to your project:

Please follow the steps below to add Leanplum to your Android Project:
  • Add the following repository to your app/build.gradle file.
    repositories {
  • After that, add the following dependencies in the same file:
    implementation 'com.rudderstack.android.sdk:core:1.+'
    implementation 'com.rudderstack.android.integration:leanplum:1.+'
    implementation 'com.leanplum:leanplum-core:5+'
  • Finally, change the initialization of your RudderClient in your Application class.
    val rudderClient = RudderClient.getInstance(
Follow these steps to add Leanplum to your iOS project:
  • Go your Podfile and add the Rudder-Leanplum extension:
    pod 'Rudder-Leanplum'
  • After adding the dependency followed by pod install , you can add the imports to your AppDelegate.m file as shown:
    #import "RudderLeanplumFactory.h"
  • Finally, change the initialization of your RudderClient as shown:
    RudderConfigBuilder *builder = [[RudderConfigBuilder alloc] init];
    [builder withEndPointUrl:DATA_PLANE_URL];
    [builder withFactory:[RudderLeanplumFactory instance]];
    [RudderClient getInstance:WRITE_KEY config:[builder build]];
Follow the below steps to add Leanplum to your Flutter Project:
  1. Add the following dependency to the dependencies section of your pubspec.yaml file.
    rudder_integration_leanplum_flutter: ^1.0.1
  2. Run the below command to install the dependency added in the above step:
    flutter pub get
  3. Import the RudderIntegrationLeanplumFlutter in your application where you are initializing the SDK.
    import 'package:rudder_integration_leanplum_flutter/rudder_integration_leanplum_flutter.dart';
  4. Finally, change the initialization of your RudderClient as shown:
    final RudderController rudderClient = RudderController.instance;
    RudderConfigBuilder builder = RudderConfigBuilder();
    rudderClient.initialize(<WRITE_KEY>, config: builder.build(), options: null);
For iOS platform, Leanplum needs to be linked either as a dynamic or static framework with your application. The same can be done by adding the below to your Podfile:
use_frameworks! :linkage=> :static // linking statically
use_frameworks! :linkage=> :dynamic // linking dynamically

The RudderStack SDKs store the traits information from the identify call in SharedPreference and NSUserDefaults for Android and iOS respectively. If RudderStack detects the userId in the persisted traits information, it starts the native SDK along with the userId . On the other hand, if it can't find the userId , it starts the SDK normally without it. This activity helps to build a better session.

The code for Android is the same as below:

Leanplum.start(applicationContext, userId) for a persisted userId and Leanplum.start(applicationContext) if it is not present.

RudderStack follows a similar pattern for iOS as well.

While searching for userId in the persisted traits, RudderStack looks for either of these fields: userId and id.


RudderStack sets the userId of the user to the Leanplum SDK via the setUserId method, and passes all the properties under context.traits to the setUserAttributes method, to get populated in Leanplum.

The following is an example of an identifycall:

[[RudderClient sharedInstance] identify:@"developer_user_id"
traits:@{@"email": @"bar@foo.com"}];


Leanplum accepts any free-flowing property and event name. So, we forward the event as is to the Leanplum SDK without any modification to the payload, as long as the eventName is not null.

The following is an example of a track call in RudderStack:

[[RudderClient sharedInstance] track:@"Accepted Terms of Service"
@"foo": @"bar",
@"foo_int": @134


Leanplum supports tracking the user-states. We use the screen calls to advance the states of the user to LeanPlum. For every screen event we are calling the advanceTo method of LeanPlum SDK along with the screen name and the properties along with it.

We also send the automatically tracked screen events to LeanPlum.

The following is an example of a screen call in RudderStack:

[[RudderClient sharedInstance] screen:@"Main"];


RudderStack calls clearUserContent method of the Leanplum SDK to clear the persisted data.

The following code snippet shows a sample reset call:

[[RudderClient sharedInstance] reset];


RudderStack sets the verbose logging for development mode for the Leanplum Native SDK, based on the logLevel of the RudderClient. If the logLevel is set as DEBUG or more, RudderStack will turn on logging using the enableVerboseLoggingInDevelopmentMode method of the Leanplum SDK.


Where do I get the Application ID and the Client Key?

You can find your Application ID and Client Key by logging on to your Leanplum account and navigating to More - App Settings . Then, click the Keys & Settings button for the application you want to integrate with, and you should get the required credentials.

Contact us

For more information on the topics covered on this page, email us or start a conversation in our Slack community.

On this page