Skip to main content

Using client-side JavaScript in personalization


Describes how and where you can use client-side JavaScript in the Sitecore Personalize application.

Sitecore Personalize supports both client-side and server-side JavaScript, depending on the feature that you are using. This topic identifies which features use client-side JavaScript, and the supported JavaScript functionality. You can also use server-side JavaScript in the Sitecore Personalize application.

Client-side JavaScript (CSJS) is an extended version of JavaScript that is used to enhance and manipulate web pages and client browsers.

Sitecore Personalize supports modern JavaScript on the client-side, JavaScript EcmaScript (ES) 6. If your organization is concerned about compatibility with Internet Explorer 11, we recommend that you apply the JavaScript ES5 style.

You can determine the CSJS that will run when the experiment runs. A marketer can apply the CSJS by adding a web template, or a programmer can write the CSJS themselves.

You can run CSJS to determine the following:

  • Run a web experience based on conditions that relate to the page that the guest is visiting.

  • Enable SItecore Personalize to access browser data, including the Document Object Model (DOM) from the browser. This enables you to manipulate the structure, style, and content of the experiment, including where and how you want the offer or content to display in the browser.

  • Use SSJS when using CSJS. This can include a full history of the guest as well as a continuous stream of real-time session data. An internal service known as the Guest Context Service generates the guest attributes on the server-side.