Performing an attributes operation is done by using the attributes client that can be accessed from the MCEPlugin class. To set or update, pass JSON with attribute names and their values, which can have different types. To delete, just pass an array of strings which correspond to the names of the attributes you want to delete for that user.

Note: Attribute updates can be non-intuitive. They are cached both on the device and the server, which can lead to issues if you update attributes from the SDK and via API.

In addition, lookup key attributes may not be updated by SDK. See Understanding user attributes for further details and limitations of using attributes from the SDK.


// To set or update one or more attributes
var json = {};
json["hobby"] = "movies";
json["age"] = 40;
json["getsCatalogue" = true; json["lastUpdate"] = new Date();


// To delete one or more attributes
var attributeKeys = ["hobby", "getsCatalogue"]; MCEPlugin.queueDeleteUserAttributes(attributeKeys);

You can add a callback on success / failure using MCEPlugin.setAttributeQueueCallbacks(successFunction, failureFunction). For example:

    console.log("attribute success");
    console.log("attribute failure")

Join The Discussion

Your email address will not be published. Required fields are marked *