Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Initialize SDK object and use it anywhere in your application.

Warning

Remember to initialize SDK only once on application launch. Don't forget to replace the %YOUR_STORE_KEY% text with the current store key from your PersonaClick account.


Code Block
languageapplescript
themeFadeToGrey
import PersonaClick
...
var
sdk = createPersonalizationSDK(
    shopId: "%YOUR_STORE_KEY%")

Or with completion to handle problems:

Code Block
languageapplescript
themeFadeToGrey
import PersonaClick
...
var sdk = createPersonalizationSDK(shopId: "%YOUR_STORE_KEY%", { (error) in
    print(error)
},
    apiDomain: "api.personaclick.com",
    enableLogs: false,
    parentViewController: (window?.rootViewController)!,
    needReInitialization: true, // Optional: Allows reinitialization of the SDK and clears the local storage.
    { error in
        // Assign the SDK instance to a global variable for reuse across the application.
        globalSDK = self.sdk

        // Notify other parts of the application about the successful initialization of the SDK.
        NotificationCenter.default.post(name: globalSDKNotificationNameMainInit, object: nil)
    }
)

Parameters

NameTypeRequirementDescription
shopIdstringrequiredThe current store key from the PersonaClick account.
apiDomainstringrequiredThe API domain for server communication.
enableLogsbooleanoptionallyEnable logs for debugging purposes during development.
parentViewControllercontrolleroptionallyThe view controller to display in-app notifications.
needReInitializationbooleanoptionallyAllows reinitialization of the SDK and clears the local storage.
userEmailstringoptionallyUser Email.
userPhonestringoptionallyUser Phone.
userLoyaltyIdstringoptionallyThe Loyalty Program user ID (loyalty card).
autoSendPushTokenbooleanoptionallyThe true value (the default) allows the token to be requested, and false disallows it.



Column


Related Pages

Filter by label (Content by label)
showLabelsfalse
showSpacefalse
sorttitle
cqllabel = "initialization"