Versions Compared

Key

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

Initialization

Place this script on all public pages of the site inside the <head> element.

WarningDon't forget to replace the %YOUR_STORE_KEY% text with the current store key from your PersonaClick account

Initialization

Initialize the SDK object and use it anywhere in your application.

Warning

Remember to initialize the SDK only once on application launch.


Code Block
languagejs
themeFadeToGrey
import PersonaClick from '@personaclick/rn-sdk';
...
const pcsdk = new PersonaClick("YOUR_SHOP_ID", "Stream")

Additional Features

The initialization method has additional features - callback functions for success and error states.

Code Block
languagejs
themeFadeToGrey
personaclick("init", store_key, success, errorstore_key, stream, debug, send_token);

Initialization parameters

Name

Type

Requirement

Description

store_keystringrequiredThe current store key from the PersonaClick account.
streamstringrequiredData stream code. Alphanumeric string (letters, numbers only). Max length: 16. It can be "ios", "android", or any other string value.
successfunctionoptionallyThe function will be executed after successful initialization.errorfunctionoptionallyThe function will be executed after unsuccessful initialization (any Personaclick API response other than 200)
It's used to distinguish between mobile apps, websites, and other events sources.
debugbooleanoptionallyAllows debugging info to be displayed in the console. Default: false.
send_tokenbooleanoptionallyAllows managing the automatic getting of Firebase/APNs token and sending it to the system. Default: true.

Example of use

Code Block
languagejs
themeFadeToGrey
personaclick("initimport PersonaClick from '@personaclick/rn-sdk';
...
const pcsdk = new PersonaClick("c6d2fe5fdca0c8e51d10b07523bc07", "c6d2fe5fdca0c8e51d10b07523bc07android", function(false, true);


Initialization Check

The method allows checking if the initialization is done or not.

Method Response

The method returns a boolean value:

  • true - initialization completed
  • false - initialization failed or ended with an error

Example of use

Code Block
languagejs
themeFadeToGrey
if (pcsdk.isInit()) {
    // Do something in case of successful initialization
    console.log("The PersonaClick initialization the initialization was successful");
}, function()else {
    // Do something in case of unsuccessful the initialization failed or ended  console.log("The PersonaClick initialization was unsuccessful");
});with an error
}



Column

Page Navigation

Table of Contents
maxLevel2

classpersonaclick-fixed-position

indent0px
stylenone




Related Pages

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