Managing Local Dynamic Data
Overview
Local dynamic data is a set of key/value pairs that can be used within Posts and Stories to further personalize the content a user sees. For example, local dynamic data can be used to have a Post that says "Good Afternoon, John Doe."
Local dynamic data never leaves the device, so it is not subject to the same privacy considerations as user attributes. However, local dynamic data cannot be used for segmentation.
Key Characteristics
- Local dynamic data provided in a single app launch is merged together but not persisted between launches.
- Newer values for a key will replace older ones.
- A key can be unset by passing a null value.
- If a key is not set but is expected in a Post or Story, an empty string will be used.
You may update local dynamic data at any point in your app's lifecycle. Updating local dynamic data will cause any Feeds or Stories currently displayed to update.
Setting Local Dynamic Data
Android
FlagshipService.getShared().setLocalDynamicData(mapOf(
"timeOfDay" to "Afternoon",
"name" to "John Doe",
// To remove dynamic data, pass null
dataToRemove to null
))
iOS
FlagshipService.shared.localDynamicData = [
"timeOfDay": "Afternoon",
"name": "John Doe",
// To remove dynamic data, pass nil
dataToRemove: nil
]
React Native
// Use the FlagshipService component returned from initializing Flagship
FlagshipService.localDynamicData = {
timeOfDay: 'Afternoon',
name: 'John Doe',
// To remove dynamic data, pass null
dataToRemove: null
};Did this answer your question?
