Create content for a web experience using custom code
To apply personalization to a web experience , you can create a variant using custom HTML, CSS, or JavaScript. When Sitecore Personalize runs the web experience, it will execute any HTML, CSS, or JavaScript configured in the variant.
For personalization to work, the variant needs to pass guest data to your organization's website. This includes details like the guest's first name, location, loyalty number, and so on. This information is known as server-side data. To facilitate, you need to compose the API request using FreeMarker, then reference it in the relevant HTML, CSS, or JavaScript code.
To create a web experience using custom code:
-
In the Experience tile, click Create variant.
-
In the Select template pane, click Create template.
-
In the code editor, use custom code on the relevant HTML, CSS, or JavaScript tabs.
-
Compose the API request using FreeMarker.
-
Click Save.
-
Click to close the code editor.