Leanplum Destination

Segment makes it easy to send your data to Leanplum (and lots of other destinations). Once you've tracked your data through our open source libraries we'll translate and route your data to Leanplum in the format they understand. Learn more about how to use Leanplum with Segment.

Getting Started

Our Leanplum destination is offered as a Server-Side destination. To utilize Leanplum’s Push Notifications or A/B testing in your mobile app, you will need to use our Android SDK.


If you’re using any of our server-side sources, our HTTP API, or our Xamarin library we will begin passing data through our servers to Leanplum within minutes after you enable it on your source destinations page.

Our Leanplum destinations supports our identify, track, and page methods.

Note: Leanplum cannot support group or alias in our server-side sources since they don’t have a REST API for those methods.


If you’re using our Android SDK we will begin sending data to Leanplum from your users’ devices as soon as you enable it on your source destinations page. If you’re using custom builds and you haven’t included Leanplum, you’ll have to make a new build.


The first thing you’ll want to do is to identify a user with any relevant information as soon as they log-in, or sign-up. You record this with our identify method.

Identify takes the userId of a user and any traits you know about them.

When you call identify, we’ll set the custom ID in Leanplum, and set any special Leanplum traits you provide, such as gender, or age.


Next you’ll want to track your user’s behavior so that you can figure out how to increase engagement, virality, or whatever key action is critical to your business. You can use the track method to do this.

Whenever you call track from our iOS or Android library, we’ll log an event with Leanplum.


To advance your user’s ‘state’ through your application, you can call page whenever a user moves to a new area. When you call page, we will call Leanplum’s advance method.

How To - Push Notifications:

As every analytics provider deals with push notifications and in app messaging differently, we currently don’t support them out of the box. To use these features with your Leanplum account, you can add a couple of small code snippets to your app, then you’re ready to go!

  1. Copy the permissions XML below into the AndroidManifest.xml and insert your package name into the name fields where it says [com.YOUR_PACKAGE].

       <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
       <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
       <uses-permission android:name="android.permission.WAKE_LOCK"/>
       <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
       <permission android:name="[com.YOUR_PACKAGE].gcm.permission.C2D_MESSAGE"
           android:protectionLevel="signature" />
       <uses-permission android:name="[com.YOUR_PACKAGE].gcm.permission.C2D_MESSAGE" />
  2. Add the receiver XML below into the same manifest file and replace [com.YOUR_PACKAGE] with your package name.

         android:permission="com.google.android.c2dm.permission.SEND" >
             <action android:name="com.google.android.c2dm.intent.RECEIVE" />
             <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
             <category android:name="[com.YOUR_PACKAGE].gcm" />
  3. Register your service in the manifest file using the below code.

     <service android:name="com.leanplum.LeanplumPushService" />

You are now ready to send push notifications from your Leanplum UI! For more information about setting up push notifications and in app messaging with Leanplum, see their docs.

How To - A/B Testing:

As with push notifications, A/B testing variables are dealt with in different ways by each of our destinations. Leanplum only requires two lines of code for each of your variables to get you set up!

  1. Define your variable using var.define any time before calling Leanplum.start.

     static Var<String> welcomeLabel = Var.define("welcomeLabel", "Welcome!");
  2. Register a valueChangedHandler on that variable.

     welcomeLabel.addValueChangedHandler(new VariableCallback<String>() {
       @Override public void handle(Var<String> stringVar) {

All done! You’re all set up to do A/B testing with Leanplum. For more information about variables in Leanplum, see their docs on Data Modeling.

Supported Sources and Connection Modes

📱 Device-based
☁️ Cloud-based

To learn more about about Connection Modes and what dictates which we support, see here.

Segment offers an optional Device-based Connection Mode for Mobile data with Leanplum. If you’d like to use those features that require client-based functionality, follow the steps above to ensure you have packaged the Leanplum SDK with Segment’s.


Segment lets you change these destination settings via your Segment dashboard without having to touch any code.

Leanplum Application Id

The application ID. To find yours, select your app in the navigation column, and click Edit Apps. Under Keys, click Show.

Leanplum Client Key

Either the Production or Development keys, depending on which API call you want to make.

Use Leanplum in Development Mode

To use development mode, you must also input your Development key as the client key.

GCM Sender ID

The GCM sender ID that should be used for Push Notifications.

Track as Supplemental Events

Select this option to send events from this source to Leanplum as non-session related events. Events that originate from this source will be marked as passive and will not be tied to a user’s session. Events from this source will also not create a new user if one does not currently exist. This option should be considered when tracking events outside of your mobile app.

Use Leanplum Sender ID

Select this if you don’t have your own GCM Sender ID, and would like to use Leanplum’s built in sender ID instead. If you have set your own GCM Sender ID and enable this setting, both IDs will be used.

If you have any questions or see anywhere we can improve our documentation, please let us know or kick off a conversation in the Segment Community!