---
title: SDK Objects
slug: sdks/objects
description: Information about the personalization class, account object, and user object of Monetate's React Web, React Native, iOS, and Android SDKs
image:  https://archbee-image-uploads.s3.amazonaws.com/ceIfEvQHzQk1IVxoRWUh7/K9eTL4jKm7UQINb6zNziJ-20250912-181225.png
docTags: 
createdAt: 2024-04-22T17:03:38.184Z
---

**The Monetate SDK consists of the following classes.**

## Personalization Class

:::Paragraph{indent="1"}
Personalization is the main class. You can use an **instance** of this to invoke the different methods of SDK.
:::

:::::Tabs
::::Tab{title="React Native"}
Import this class using the following code:

:::CodeblockTabs
Code to Import personalization Class

```javascript
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:

:::CodeblockTabs
Code to Create a personalization Class Instance

```javascript
const personalizationInstance = personalization (  
  account,
  user
)
```
:::
::::

::::Tab{title="React Web"}
Import this class using the following code:

:::CodeblockTabs{indent="1"}
Code to Import personalization Class

```javascript
import personalization from '@personalization-js-sdk/web';
```
:::

- `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:

:::CodeblockTabs{indent="1"}
Code to Create a personalization Class Instance

```javascript
const personalizationInstance = personalization (  
  account,
  user
)
```
:::
::::

::::Tab{title="iOS"}
:::CodeblockTabs
Code to Import personalization Class

```swift
import Foundation
import monetate_ios_sdk
```
:::

`account` and `user` are classes, 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:

:::CodeblockTabs
Code to Create a personalization Class Instance

```swift
final var personalization = Personalization(account: Account(instance: "p", domain: "localhost.org", name: "a-701b337c", shortname: "localhost"), user: User(monetateId: "2.1454546575.1711006580023", deviceId: "62bd2e2d-213d-463f-83bb-12c0b2530a14", customerId: "12345")) 
```
:::
::::

::::Tab{title="Android"}
Create an instance of this class using the following code:

:::CodeblockTabs
Code to Create a personalization Class Instance

```java
Personalization personalization = new Personalization(user,account);
```
:::

`account` and `user` are classes, 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.

If any of the parameters of the `Account` class are missing, then this class constructor throws the `AccountDetailsException`. You must handle the exception using this class. Here's an example:

:::CodeblockTabs
Example Code to Handle AccountDetailsException

```javascript
try    
  {
    Personalization  personalization = new Personalization(user, account);
  } catch (AccountDetailsException e) {
    e.printStackTrace();
  }
```
:::
::::
:::::

***

## 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*)&#x20;
- Falls back to the default endpoint (`engine.monetate.net`) when`engineHost` 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.](https://developer.monetate.com/sdks/engine-endpoint-configuration)


:::::Tabs
::::Tab{title="React Native"}
Create an instance of this class using the following code:


:::CodeblockTabs
Code to Export account Object

```typescript
const account = {
    domain: "", // Domain name
    name: "",// Account name
    instance: "",// Instance for the domain
    shortname: "", // Short name for the account
    engineHostName:""// Optional: Override engine endpoint
};
```
:::
::::

::::Tab{title="React Web"}
Create an instance of this class using the following code:


:::CodeblockTabs
Code to Export account Object

```java
const account = {
    domain: "", // Domain name
    name: "",// Account name
    instance: "",// Instance for the domain
    shortname: "", // Short name for the account
    engineHostName:" "// Optional: Override engine endpoint
};
```
:::
::::

::::Tab{title="IOS"}
Create an instance of this class using the following code:


:::CodeblockTabs
Code to Export account Object

```java
let newAccount = Account( 
  instance: "", //instance for the domain
  domain: "",// Domain name
  name: "", // Account name
  shortname: "", // short name for the account
  engineHostName: "")//  Optional: Override engine endpoint
```
:::
::::

::::Tab{title="Android"}
Create an instance of this class using the following code:

:::CodeblockTabs
Code to Export account Object

```java
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 endpoint
```
:::

You must provide data for this class.
::::
:::::

### Code Example

:::::Tabs
::::Tab{title="React Web"}
:::CodeblockTabs
Example Code to Export account Object

```javascript
const account = {
  domain: "monetate.mybigcommerce.com",
  name: "a-3e41bf76",
  instance: "p",
  shortname: "monetatebc",
  engineHostName:"engine-us-east-1.monetate.net"
};
```
:::
::::

::::Tab{title="React Native"}
:::CodeblockTabs
Example Code to Export account Object

```javascript
const account = {
  domain: "monetate.mybigcommerce.com",
  name: "a-3e41bf76",
  instance: "p",
  shortname: "monetatebc",
  engineHostName:"engine-us-east-1.monetate.net"
};
```
:::
::::

::::Tab{title="iOS"}
:::CodeblockTabs
Example Code to Export account Object

```swift
let account = Account(
  instance: "p",  
  domain: "localhost.org",  
  name: "a-701b448c",  
  shortname: "localhost",  
  engineHostName: "engine-us-east-1.monetate.net"
)
```
:::
::::

::::Tab{title="Android"}
:::CodeblockTabs
Example Code to Export account Object

```java
Account account = new Account();     
account.setDomain("monetate.mybigcommerce.com");
account.setName("a-3e41bf76");
account.setInstance("p");
account.setShortname("monetatebc");
account.setEngineHostName("engine-us-east-1.monetate.net");
```
:::
::::
:::::

***

## User Object

:::Paragraph{indent="1"}
This object contains information about the user.
:::

:::::Tabs
::::Tab{title="React Native"}
Create an instance of this class using the following code:

:::CodeblockTabs
Code to Create user Object Instance

```javascript
export const user = {
  deviceId: '', // Device ID
  monetateId: '', // Monetate ID
  customerId: '', // Customer ID
};
```
:::

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` — Used for customer identification. You can generate this ID using the [generateMonetateId](docId\:F5SIeJXaS3hi38DaXdVPy) 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](docId\:F5SIeJXaS3hi38DaXdVPy) method.

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


::::

::::Tab{title="React Web"}
Create an instance of this class using the following code:

:::CodeblockTabs
Code to Create user Object Instance

```javascript
export const user = {
  deviceId: '', // Device ID
  monetateId: '', // Monetate ID
  customerId: '', // Customer ID
};
```
:::

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](docId\:F5SIeJXaS3hi38DaXdVPy) 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](docId\:F5SIeJXaS3hi38DaXdVPy) method.

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

::::Tab{title="iOS"}
Create an instance of this class using the following code:

:::CodeblockTabs
Code to Create user Object Instance

```swift
let user = User(
  monetateId: ,  // Monetate ID
  deviceId: ,  // Device ID
  customerId:   // Customer ID.
)
```
:::

When creating this object, 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` — An ID generated from the Monetate server. You can generate this ID using the [generateMonetateId](docId\:F5SIeJXaS3hi38DaXdVPy) method of the `Personalization` class.
- `deviceId` — The ID of the customer's device. The recommended ID to use.
- `customerId` — The ID of the customer. 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](docId\:F5SIeJXaS3hi38DaXdVPy) method.

When you create a `Personalization` object for the first time, there is no Monetate ID to associate with the `User` object. You must first initialize a `User` object with a device ID. After you do that, you can generate a Monetate ID for the `User` object by calling the `generateMonetateID` method. The following example code demonstrates how to do this:

:::CodeblockTabs
Example Code to Call the generateMonetateID Method

```swift
final var objPersonalization = Personalization(account: Account(instance: "p", domain: "localhost.org", name: "a-701b337c", shortname: "localhost"), user: User(deviceId: "62bd2e2d-213d-463f-83bb-12c0b2530a14", customerId: "12345")) 
let monetateId =  objPersonalization.generateMonetateID()
```
:::
::::

::::Tab{title="Android"}
Create an instance of this class using the following code:

:::CodeblockTabs
Code to Create user Object Instance

```java
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 ID
```
:::

When 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](docId\:F5SIeJXaS3hi38DaXdVPy) 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](docId\:F5SIeJXaS3hi38DaXdVPy) method.

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

***
::::
:::::

## Context Layer&#x20;

:::BlockQuote{indent="1"}
**Note:&#x20;**&#x54;he Context Layer is currently supported on the **Android** and **iOS** SDKs only.The **React SDK** is not impacted by these changes.
:::

:::Paragraph{indent="1"}
**Available from**
:::

:::Paragraph{listStyleType="disc" indent="2"}
<font color="#2166ae">**Android**</font>**&#x20;:** 1.0.8-A and later&#x20;
:::

:::Paragraph{listStyleType="disc" listStart="2" indent="2"}
<font color="#2166ae">**React Native**</font>**&#x20;:** 1.0.4-RN and later&#x20;
:::

:::Paragraph{listStyleType="disc" listStart="3" indent="2"}
<font color="#2166ae">**React Web**</font>**&#x20;:** 1.0.2-W and later&#x20;
:::

:::Paragraph{listStyleType="disc" listStart="4" indent="2"}
<font color="#2166ae">**iOS**</font>**&#x20;:** 2026.04.28 and later
:::

:::Paragraph{listStyleType="disc" listStart="5" indent="2"}

:::

- The [Context Layer](https://developer.monetate.com/sdks/context-layer-implementation-guide) is a core SDK component responsible for collecting, structuring, and storing all event-level and contextual data required by:
  - Reporting APIs (report methods)&#x20;
  - `getActions()` method&#x20;

    It acts as a **unified data container**, ensuring all downstream SDK operations receive only the required and validated inputs.

:::Paragraph{indent="1"}
Once populated, a Context object can be used for:
:::

:::Paragraph{listStyleType="disc" indent="2"}
Reporting data using `report` methods&#x20;
:::

:::Paragraph{listStyleType="disc" listStart="2" indent="2"}
Retrieving actions using `getActions() `
:::

:::Paragraph{listStyleType="disc" listStart="3" indent="2"}
Supporting **multi-context evaluation**, where multiple contextual signals must match to return actions&#x20;
:::

:::Paragraph{indent="1"}
The Context object serves as the **single source of truth** for all personalization input data.
:::

