Client SDK

Personizely exposes some Javascript methods to give you more flexibility in using it.

Identify API


This method returns a Promise.

data - object, containing information about the visitor and custom fields values. The object can have the following properties:

email - string, a valid email address firstName - string, visitor's first name lastName - string, visitor's last name phone - string, visitor's phone number companyName - string, visitor's company name companyTitle- string, visitor's company title marketingConsent- boolean, visitor's marketing consent status privacyConsent- boolean, visitor's privacy consent status address - string, visitor's address bio - string, visitor's bio customFieldValues - object, visitor's custom field's values

The custom field values object is an object where the keys are the custom fields id's which can be found on the Settings page and the values are the values of the respective fields for the current visitor.

For radio and select field types you need to make sure that the choice options are valid ones, so if you have a field named "Gender" with 2 options: Male, Female, you won't be able to save a different value than one of those two values. The checkbox type fields should receive a boolean value. The number type fields should receive a numeric value.



Goal Tracking API

ply.trackGoal(eventName, value)

This method is used to track custom goals.

eventName - string, the name of the event (this should be the name of an existing goal in your Personizely website settings). value - number, goal value in the currency of your website

For example, to track a purchase worth 100$ on your site, you can use the following code on your thank-you page: ply.trackGoal('Purchase', 100)

Manual Widget Trigger

ply.showWidget(id, suppressRules)

This method is used to show up any widget indifferently of the triggers it has assigned to it.

id - integer, the id of the widget suppressRules - boolean, whether to suppress the widget rules

Updated 02 Jun 2022
Did this page help you?