What is Custom JS?

Custom JS consists of lines of Javascript code that can be added to execute a specific function. In the context of segmentation, users can segregate users based on various conditions or segment types by default. However, if there is a need to group specific users based on different attributes not already provided, users have the option to write Custom JavaScript to achieve this purpose.

1.  Log in to the Admin Portal.

2. Select your Application from the left panel.

3. Click Manage Application.

select application

4.  Click Custom JS.

5.  Enter the custom script for the appropriate environments.

    Custom JS contains two scripts:

User Segmentation JavaScript: JavaScript that is executed to collect the data needed for Segmentation ie, for identifying the user and creating segments
Application Level JavaScript: JavaScript to customize the application behaviour at a DOM level

custom js scripts-1

6.  Click Save.

Note:

The saved Javascript runs in the back end and the returning keys can be used in segmentation or other functions.

Publishing Custom JS

Once you save the script, it should be published so that the code becomes available in the required application.

To publish:

1.  From the Manage Current Application page, click the ellipsis icon.

2.  Select the Environment that needs to be published.

3.  Click Publish Latest.