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.
Import this class using the following code:
import personalization from '@personalization-js-sdk/react-native';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:
const personalizationInstance = personalization (
account,
user
)Account Object
This object contains information about the account. Configurable Engine Endpoint Support Across SDK (Android , IOS, React) Support has been introduced to configure the engine endpoint dynamically using the engineHostName field in the Account object.
Key Benefits:
- Enables flexible endpoint selection based on environment (e.g., regional, staging, custom deployments)
- Falls back to the default endpoint (engine.monetate.net) whenengineHost is not provided or set to null, empty
Usage Overview: Developers can optionally pass the engineHostName while initializing the Account object. If omitted, the SDK automatically uses the default production endpoint. refer to Engine Endpoint Configuration.
Create an instance of this class using the following code:
Account account = new Account();
account.setDomain(""); // Domain name
account.setName(""); // Account name
account.setInstance(""); // Instance for the domain
account.setShortname(""); // Short name for the account
account.setEngineHostName("")// Optional: Override engine endpointYou must provide data for this class.
Code Example
const account = {
domain: "monetate.mybigcommerce.com",
name: "a-3e41bf76",
instance: "p",
shortname: "monetatebc",
engineHostName:"engine-us-east-1.monetate.net"
};User Object
This object contains information about the user.
Create an instance of this class using the following code:
User user = new User();
// Set only one of these IDs
user.setDeviceId("1109349827122"); // Device ID
user.setMonetateId("2.1189737281.1718190856247"); // Monetate ID
// Set the customer ID only if you have one
user.setCustomerId("customer@xyz1234567"); // Customer IDWhen creating this class, you must set either the device ID or the Monetate ID with the above method calls. The recommended ID to use is the device ID.
- monetateId— Used for customer identification. You can generate this ID using the generateMonetateId method of the Personalization class.
- deviceId — 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.
Context Layer
Available from
- Android : 1.0.8-A and later
- React Native : 1.0.4-RN and later
- React Web : 1.0.2-W and later
- iOS : 2026.04.28 and later
-
- The Context Layer is a core SDK component responsible for collecting, structuring, and storing all event-level and contextual data required by:
- Reporting APIs (report methods)
- getActions() method It acts as a unified data container, ensuring all downstream SDK operations receive only the required and validated inputs.
Once populated, a Context object can be used for:
- Reporting data using report methods
- Retrieving actions using getActions()
- Supporting multi-context evaluation, where multiple contextual signals must match to return actions
The Context object serves as the single source of truth for all personalization input data.