Skip to main content
Users
CloudPortalLogin
  • Powered byPowered by
Developing with Sitecore CDP
Data privacy
Before you start sending data
Integrating with Sitecore CDP
Stream API
Batch API
REST APIs
Data lake export service
  • Sitecore CDP for developers
  • Integrating with Sitecore CDP
  • Understanding integration details
  • Running personalization

Running personalization

Note

This topic assumes that you have Sitecore Personalize, and that you have web experiences or web experiments to work with.

You can run personalization in your app that you integrated using the Engage SDK. Personalization is possible using web experiences and web experiments.

Running web experiences and web experiments

While you're initializing the Engage SDK, you can decide whether to run web experiences and web experiments in your app. You can run web experiences and web experiments by setting the webPersonalization attribute to true in the settings object in the Engage.init() function, on the client side of your app. This attribute is not available on the server side.

Loading the web personalization script

When you enable web experiences and web experiments, a web personalization script will load in your app. By default, the script loads asynchronously. You can set the webPersonalization attribute to an object, where you can change how the script loads. For example, you can choose to load it synchronously, or with or without defer. You can also load the script from a custom URL if you received one from Sitecore.

Important

If your Stream API target endpoint is in JP Region, load the web personalization script from the following URL:

{ baseURLOverride: "https://d2ez8k04aaol9g.cloudfront.net" }

Rerunning web experiences and web experiments

When the Engage functionality first loads in your app with the webPersonalization attribute set to true in the settings object, web experiences and web experiments run once. The experiences and experiments don't automatically run again on the same page. This means that you'll need to rerun experiences and experiments in, for example, the following scenarios:

  • You want to run personalization multiple times on the same page, for example, after the user fills out a form field or clicks a button.

  • You have a single-page application (SPA), which consists of only one web document, and you want to run personalization when the user navigates between routes.

Using the Engage SDK, you can rerun web experiences and web experiments by using the Engage.triggerExperiences() function.

Behavioral and transactional data in personalized content

Using the Engage SDK, you can collect and send behavioral and transactional data that occur inside a web experience or a web experiment. To achieve this, you need to call Engage functions inside your web experience or web experiment.

If you integrate using the Engage SDK script, you can call, for example, the Engage.pageView() function inside your web experience or web experiment.

If you integrate using the Engage SDK package, you first need to expose the Engage functions to the window object. You can expose them by assigning the return value of the Engage.init() function to the window object. For example, you can assign the return value to window.engage. You can then call, for example, the engage.pageView() function inside your web experience or web experiment.

Do you have some feedback for us?

If you have suggestions for improving this article,

Privacy policySitecore Trust CenterCopyright © 1999-2025 Sitecore