Personalization
Using the Cloud SDK personalize package, you can run interactive experiences and interactive experiments that are live in Sitecore Personalize. These are personalizations that marketers create and configure in Sitecore Personalize.
SitecoreAI personalizations run automatically in JSS Next.js apps, with no coding required.
In the personalize package, the browser module lets you run personalization from the browser, and the server module lets you do it from the server. When you run the personalize function, you have to pass it the personalization data object. In this object, you have to provide the friendly ID of the experience or experiment you want to run, and the channel and the currency.
When you run an interactive personalization, two things happen:
-
As part of the network request, a payload is sent to Sitecore. The payload contains the friendly ID of the experience or experiment you want to run, and other required and optional data that you included in the personalize data object. If the URL of the webpage where the
personalizefunction runs contains UTM parameters, the payload will also contain the UTM parameters. -
The personalized content is returned as part of the API response. You can use the received API response to display the content to your site visitor or take some other action based on the received data.
Example of interactive experience
Consider an interactive experience that is live in Sitecore Personalize. This experience has the friendly ID interactive_1, and its API response is configured to return the date the site visitor was first seen on your site:
You can run this experience on your site by running the asynchronous personalize function, passing in the friendly ID of the experience. The function returns the API response of the experience. You can save the return value into a variable, for example, personalizeResponse, then log the value to the console:
The following is logged to the console:
In this example, you can display a personalized message to your site visitor depending on when they were first seen on your site.
If the API response is {"message":"No flow executed"}, make sure to start the experience or experiment so it's live in Sitecore Personalize.