SDK Objects

The Monetate SDK consists of the following classes.

Personalization Class

Personalization is the main class. You can use an instance of this to invoke the different methods of SDK.

React Web
React Native
iOS
Android

Import this class using the following code:

Code to Import personalization Class


account and user are objects, and must be initialized to use as arguments for creating an instance of personalization. Refer to the object descriptions in this documentation for information on how to initialize them.

Create an instance of this class using the following code:

JS


Account Object

This object contains information about the account.

React Web
React Native
iOS
Android

Export this class using the following code:

Code to Export account Object


You must provide data for this object.

Code Example

React Web
React Native
iOS
Android
Example Code to Export account Object


User Object

This object contains information about the user.

React Web
React Native
iOS
Android

Create an instance of this class using the following code:

Code to Create user Object Instance


When creating this object, you must provide either the device ID or the Monetate ID. The recommended ID to use is the device ID.

  • monetateId — This is used for customer identification. You can generate this ID using the generateMonetateId method of the Personalization class.
  • deviceId — This identifies the mobile device ID and is provided by the customer. Used for customer identification. The recommended ID to use.
  • customerId — This ID is optional. If you define it here, you must also pass it in calls with the other ID you use. You can later change the customer ID with the setCustomerId method.

You can store the device ID or Monetate ID locally to identify the same customer later.