Syncing variables to Leanplum
Syncing and changing variable values in the Leanplum dashboard
Syncing new variables to the dashboard
Variables sync to the dashboard by running the latest version of the app (with the new variables) in debug mode on a registered test device. For more information on running in debug mode, please see the developer documentation under one of our SDK setup guides.
You'll also have to hit the sync button in the dashboard to finish updating your variables.
Removing variables
To delete variables from the dashboard, run the latest version of your app (with the variables deleted) on a debug/test device.
To prevent variables from reoccurring in the dashboard, we recommend unregistering all devices from the dashboard except the device you will be syncing with. Then, do a clean install of the newest version of your app (with the variables deleted) on the test device you wish to sync with. If issues persist, see below for another solution.
Variables disappearing or reappearing in the dashboard
If you notice a variable is missing, it’s possible that a version of the app without the variable coded has been run last. Each time you run the app in debug mode on a registered debug device, Leanplum checks for changes in variables and will sync to the last version of the app ran.
If you have a persisting issue with variables disappearing from a user syncing with the dashboard, you can revoke the developer key by going to Manage Apps (located at the bottom of the app selector drop down) > Keys & Settings > see API Keys. Revoke the old key by clicking Revoke. Lastly, you’ll want to issue a new development key for use at the bottom of the menu. Use this development key on the device you wish to sync with only until the sync is complete.
You'll need to replace your old dev key with the new one in your app as well. See the Leanplum SDK setup for more on setting up your dev key. Any test devices that were using the previous dev key will have to re-register.
Preserve variables
If your team has a lot of developer devices to keep track of, you may want to "lock" your variables in place to prevent them from being overwritten. Contact your CSM if you are interested in preserving variables.
Changing variable values in the dashboard
Once a variable is synced to the dashboard, the value coded into the variable will be listed under the Defaults in code. To change the value of the variable, you can make that change within the Overrides.
Changing values via the API
You can change values remotely or run A/B test using our Data Modeling API. Using the API, you don’t have to statically define a value in your app, allowing you to wrap that definition in our SDK so that we store the value on our servers.
The values can be anything – files, text, numbers, lists, key-value dictionaries. Once Leanplum is aware of the value, the change can be made directly from your Leanplum dashboard where you can publish changes to your users.
Syncing Variables Manually from Unity SDK
Starting from Unity SDK 3.1.0, Variables can be synced directly from code, without the need to register a test device and sync from the Dashboard. You only need to run in Dev mode.
Note that this method is intended to be used as a one-off, on demand. For example, you create a new variable in the code or do another change that requires syncing the variables to the Dashboard. Then you can add this method in the code, run the app in dev mode directly in the Unity Editor, check that the changes synced successfully, and then remove the method call from the code. It is not supposed to be used as part of the app released version.
Call the Leanplum.ForceSyncVariables
method to sync the variables, it accepts a callback or null as a parameter:
Leanplum.ForceSyncVariables(null); // without callback
Leanplum.ForceSyncVariables((success)=>
{
Debug.Log("Force Syncing Variables completed with: " + success);
});
Once the sync is completed, just refresh the Variables page on the Dashboard.
Updated over 2 years ago