Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Main script
Place this script on all public pages of the site inside the <head> element.
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 | ||||
---|---|---|---|---|
| ||||
<script> (function(){ window.personaclick=window.personaclick||function(){(window.personaclick.q=window.personaclick.q||[]).push(arguments)}; var c="//cdn.personaclick.com",v="/v3.js",s={link:[{href:c,rel:"dns-prefetch"},{href:c,rel:"preconnect"},{href:c+v,rel:"preload",as:"script"}],script:[{src:c+v,async:""}]}; Object.keys(s).forEach(function(c){s[c].forEach(function(d){var e=document.createElement(c),a;for(a in d)e.setAttribute(a,d[a]);document.head.appendChild(e)})}); })(); personaclick("init", "import PersonaClick ... var sdk = createPersonalizationSDK(shopId: "%YOUR_STORE_KEY%"); </script> |
Additional Features
The initialization method has additional features - callback functions for success and error states.Or with completion to handle problems:
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("init", store_key, success, error); |
import PersonaClick
...
var sdk = createPersonalizationSDK(shopId: "%YOUR_STORE_KEY%", { (error) in
print(error)
}) |
Parameters
Name | Type | Requirement | Description |
---|
shopId | string | required | The current store key from the PersonaClick account. |
userEmail | string | optionally | User Email. |
userPhone | string | optionally |
User Phone. |
userLoyaltyId |
string | optionally | The |
Loyalty Program user ID (loyalty card). |
autoSendPushToken |
boolean |
language | js |
---|---|
theme | FadeToGrey |
personaclick("init", "c6d2fe5fdca0c8e51d10b07523bc07", function() {
// Do something in case of successful initialization
console.log("The PersonaClick initialization was successful");
}, function() {
// Do something in case of unsuccessful initialization
console.log("The PersonaClick initialization was unsuccessful");
});
optionally | The true value (the default) allows the token to be requested, and false disallows it. |
Column | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Related Pages
|