Skip to main content

Update user metadata

Once you have registered your application user, you can attach a single level dictionary with key-value pairs that describe additional information about your user, or their application usage.

Updating the user metadata is performed by calling the Shake.updateUserMetadata anywhere in your code after registering the user.


The user metadata dictionary has its limitations: It supports a maximum of 100 keys, it doesn't allow nested dictionaries, and the total dictionary size when serialized to Data can't exceed 50 KB. If this validation fails, the update method is dropped with the appropriate console message.


Shake Dashboard uses first_name, last_name and end_user_id keys from the user metadata for presentation purposes. We recommend using these keys when sending appropriate user metadata to have a nice overview of your users on the Dashboard.

Updates to the user metadata are incremental, or perhaps a better way to describe it would be merged.

This means that the user metadata key-value pairs are being updated and not overwritten, giving you a possiblity to update the user metadata in chunks from various points of your application, even when offline.

A common approach would be updating the generic user metadata from one place in your code, upon every user change, and update the specific metadata in their respective contexts.

class UserManager {
func didLogin(response: UserResponse) {
/// Some post log in operations
func userInfoDictionary() -> Dictionary<String, Any> {
return [
"first_name": self.currentUser.firstName,
"last_name": self.currentUser.lastName,
"status": self.currentUser.status,
class CartViewModel {
func didAddItem(itemId: String) {
/// Item was added to cart operations
let cartItems = self.currentCartItems();
"cartItems": cartItems.description
func didClearAllCartItems() {
/// Cart was cleared
"cartItems": "empty"