Importing and Exporting Data From Leanplum

Leanplum supports a variety of methods to import and export data. We are currently integrated with many platforms, including Data Connectors (e.g. mParticle, Segment) and Attribution Providers (e.g. Apsalar, Appsflyer, TUNE, Kochava, Adjust). And, for any other platform, our flexible API can be used to transmit data between systems.

Below are the various ways you can import data into and export data from Leanplum.

Importing Data

From Data Connectors

The easiest way to send data between multiple platforms is to use Data Connectors like mParticle and Segment. These services allow you to turn on and turn off third-party services and ensure that the same dataset is being captured by all platforms.  

Leanplum has integrations for both mParticle (iOS and Android) and Segment.io (iOS and Android).

From Attribution Providers

If you are running install advertising campaigns to drive app installs, you can use attribution providers to easily track your install sources. This data — when sent to Leanplum — can be used to target and segment users for use in campaigns, tests, and analytics.

Leanplum is integrated with all attribution providers for easy access to this information.

From a CSV File

For a one-off import of users or user data, such as adding historic push tokens or user email addresses, you can import your data using a CSV file upload. Be sure to include the User ID and the attributes you want to associate with that user in a single row of the CSV file. Once uploaded and processed, this information will be stored in Leanplum and available in our platform for targeting and segmenting users.

See Import user data from a CSV file for more information.

Via Our REST API

You can import any other data into Leanplum using our API. This can include setting attributes for a user, such as their loyalty tier of other profile information. You can also track user events through the API, which is useful in situations where you want to trigger a messaging campaign from a user's activity in another platform.

Exporting Data

You can export raw user activity data, export lists of users that match certain criteria, or export analytics reports. You can also add postbacks to stream data to another location when those events occur. Additionally, you can retrieve information about A/B tests or messages created in the Leanplum dashboard. Any of these methods can be used to retrieve data from Leanplum for further analysis in your internal systems.

Raw user activity data can either be exported using the REST API, or automatically sent to an Amazon S3 bucket. All other forms of raw data must be exported using the REST API.

Postbacks for Messaging Events

When you want to analyze message events, such as sends, opens, clicks, etc., Postbacks are an automated way for Leanplum to communicate this information to another source in real-time. By adding an API Endpoint to Leanplum’s Postback list, Leanplum will forward all messaging events to this endpoint.

See our API documentation for how to Add a Postback.

Webhooks

Webhooks are a flexible message channel in Leanplum that allows you to trigger messages from other platforms directly from the Leanplum Dashboard. With a webhook, you can target, trigger, and test messages as you would with other channels. Webhooks allow you to define an API endpoint, and whenever a user triggers the campaign Leanplum will make a request to this endpoint.

An example of a webhook campaign would be using the API of an SMS provider to send text messages to a user.

Raw Data Exports (API)

All data from Leanplum can be exported. This includes the ability to manually pull data or have raw data exports automated for you. For instances in which all of Leanplum’s data is required, the Raw Data Exports is the method to use. This includes all data sent to Leanplum from a user, including all attributes and events tracked for every user.

Learn more about how to use the REST API to export data.

Leanplum’s raw user activity data contains information about:

  • a user’s attributes
  • device information
  • events a user has triggered
  • states a user has reached
  • messages a user has been sent
  • A/B tests a user has been a part of

User CSV Downloads

Within the Leanplum Dashboard, CSV lists can be downloaded from the User’s Tab. This is useful when you need a list of User IDs for a targeting list in another platform. You can also use Leanplum’s segmentation capabilities in the User's tab to query a target list of users, and then download the resulting list of User IDs for use outside of Leanplum.

Automatically send raw data to an S3 Bucket

To send raw user activity data to an Amazon S3 bucket, navigate to the App Settings page by clicking on the App Selection menu at the top of the screen, and select Manage Apps (Note: This menu will be accessible from any page of the Leanplum platform).

Once in the App Settings page, do the following:

  1. Find the app you wish to enable automatic exports for and click on the Keys & Settings link (Note: This requires your account to have Admin or Member privileges for that team)
  2. Click on the Export tab
  3. Enter your AWS access ID, access key, and S3 bucket name
  4. Enter an S3 object prefix (optional)
  5. Decide whether you’d like to receive compressed files in gzip format, and if so, check the checkbox to the right of Compress files (gzip)
  6. Decide the frequency with which you’d like to receive the export
  7. Click Done

Collect A/B test data using our SDK

If you're working with a large number of users and want to track their involvement with all of your A/B tests, another option is to call Leanplum.variants() after start(). This method returns a list of dictionary items with the user's current variant IDs for A/B tests, which you can then send to your server.


[
    {id=6462488122490880},
    {id=0000000000000000}
]

Important: It's best practice to wait for Leanplum to finish syncing before calling Leanplum.variants(), to ensure the variants data is as up-to-date as possible. You can do so using callbacks, specifically the onStartResponse (iOS) and addStartResponseHandler (Android) methods which are fired when the start call is completed. Learn more about using callbacks for iOS and Andriod.

From there, you can call our API with the action getAbTests, which will return all of your A/B tests, with nested arrays of variants for each. This will allow you to map each user's variants back to an A/B test.


{
  "response": [
    {
      "abTests": [
        {
          "id": 5108342379249664,
          "created": 1478637286.809,
          "name": "Welcome Message a/b test",
          "variants": [
            {
              "id": 6462488122490880,
              "percent": 50,
              "name": "Control"
            },
            {
              "id": 6117096423948288,
              "percent": 50,
              "name": "Disable Welcome Message"
            }
          ],
          "active": true
        }
      ],
      "success": true
    }
  ]
}

Was this article helpful?
Have more questions? Submit a request