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.
import Foundation
import monetate_ios_sdk
Create an instance of this class using the following code:
func setupPersonalizationSDK() {
Personalization.setup(
account: account,
user: user
)
}
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.
Export this class using the following code:
let account = Account(
instance: , // Instance for the domain
domain: , // Domain name
name: , // Account name
shortname: // Short name for the account
)
You must provide data for these variables.
Example code:
let account = Account(
instance: "p", // Instance for the domain
domain: "localhost.org", // Domain name
name: "a-701b448c", // Account name
shortname: "localhost" // Short name for the account
)
User Object
This object contains information about the user.
Create an instance of this class using the following code:
let user = User(
monetateId: , // Monetate ID
deviceId: , // Device 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.
You can define the Monetate ID as "auto" to make the SDK automatically generate the ID. If you do this, you must store the generated Monetate ID on your end.
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.