Preserve variables
Contact your CSM if you'd like to enable this feature for your app.
Once this feature is activated for your app, every variable that is synced via our SDK or API will be retained in the Leanplum content management system. We will no longer remove any variables missing or removed in one of your builds.
How it works
If you have an Android and iOS app, you can now create different variables between them, without worrying about a sync deleting any unused or missing variables.
So, if you run an Android build with var1
, var2
, var3
and then run an iPhone build with var3
, var4
, var5
, the following will be stored: var1
, var2
,var3
(from the latest sync, which is from the iPhone), var4, and var5. If you run the Android build last, then the var3
value from Android will be stored.
The last value of a variable will always be used, so conflicts (between Android and iPhone) still require some care.
Note on arrays
With groups/arrays/lists, the most recent sync will completely overwrite the value of the variable. For example, if
var3
above were a list with values 1, 2 and 3 in Android, but only value 1 in iPhone, the sync from the iPhone build would overwrite the value of this variable andvar3
would only contain the value 1.
Delete a variable
Because variables are preserved, the only way to delete a variable is via our API. To delete variables, simply use the deleteVars
call.
Arguments
parameter | type | description |
---|---|---|
appId | string | Your Leanplum app Id. |
clientKey | string | Your development key. |
apiVersion | string | The version of our api. Use 1.0.6. |
action | string | The API action (deleteVars). |
vars | list | A list of variables to remove. |
Example:
POST /api?action=deleteVars
{
"appId": "YOUR_APP_ID",
"clientKey": "YOUR_DEVELOPMENT_KEY",
"apiVersion": "1.0.6",
"vars": ["variableToDelete1", "variableToDelete2"]
}
Response:
{
"response": [
{
"variablesRemoved": [
"variableToDelete1",
"variableToDelete2"
],
"success": true
}
]
}
Updated almost 6 years ago