SDK Objects

The 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.

Create an instance of this class using the following code:

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 objects below for information on how to initialize them.

Account Object

This object contains information about the account.

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

You must provide data for these variables.

Example code:

Account account = new Account();     
account.setDomain("monetate.mybigcommerce.com");
account.setName("a-3e41bf76");
account.setInstance("p");
account.setShortname("monetatebc");

User Object

This object contains information about the user.

Create an instance of this class using the following code:

User user = new User(); 
user.setCustomerId(null); // Customer ID
user.setDeviceId(null); // Device ID

When creating this object, you must provide the device ID. The Monetate ID is generated on the server side. If you do not pass the device ID, then Monetate generates a Monetate ID that you must store client side.

The customer ID is optional. If this ID is defined, you must also pass it in all calls along with one of the other IDs. If you need to later change the customer ID, use the setCustomerId method.