Adding variables

With Leanplum variables, you can control you app's data remotely without having to resubmit the app to the App Store. Any data type in your app can be tagged as a variable. Those values will then automatically sync to our servers. Some of these data types can include floats, booleans, strings, arrays, dictionaries, etc. You can also create A/B tests to change variables for only a percentage of your users, and test the effect of those changes.

There are two ways to add variables to your app, which will then appear on the Variables page in the Leanplum dashboard:

  • Define the variables in your app’s code, then run a Debug build on a registered developer device (Recommended method)
  • Via the REST API, using the setVars action

In this article, we'll show you how to add variables using the first method. If you would like to add variables using the REST API, see our documentation.

If you click on Variables in the left side nav bar you will see all of the variables from your app which have been tagged and synced to Leanplum. The variable values that are hard-coded into your app are represented in the Defaults in Code column. The Overrides column is where you can modify those values for all or a segment of your users.

Upon running a debug build on a registered developer device (see Adding and registering a test device for more information) you will then need to click on the Update variables for your connected developer device button at the top of the Overrides column. This will update any newly tagged variables and modify existing values to reflect changes since you last synced variables. If for any reason you or someone on your team is running an older version of your app with different variables, be cautious to not click to update variables, as this would cause your current variables to be overwritten.

For more information about variables, please review the data modeling section of our developer documentation.


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