Exporting data from Leanplum

Leanplum has a variety of raw data exports available. 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.

Use our API to export data

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

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