Skip to main content
Sitecore Documentation
  • Learn
  • Downloads
  • Changelog
  • Roadmap
PersonalizeCloud Portal
Sitecore Personalize
        • Getting started
            • Create content using a web template
            • Create content using custom code
            • Use HTML
            • Use CSS
            • Use JavaScript
            • Inserting an experience in your HTML
        • Target a webpage
        • Apply a condition
        • Apply a segment
        • Use a decision model
    • SitecoreAI experiences
    • Using the experience list
    • Manage experience details
    • Set up email notifications
    • View performance analytics
    • View operational data
    • Duplicate, delete, and view details
  • Using client-side JavaScript
  • Glossary
  1. Introduction to experiences
  1. Sitecore Personalize
  2. Introduction to experiences
  3. Introduction to web experiences in Sitecore Personalize

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:

  1. In the Experience tile, click Create variant.

  2. In the Select template pane, click Create template.

  3. In the code editor, use custom code on the relevant HTML, CSS, or JavaScript tabs.

  4. Compose the API request using FreeMarker.

  5. Click Save.

  6. Click to close the code editor.

If you have suggestions for improving this article, let us know!

© Copyright 2026, Sitecore A/S or a Sitecore affiliated company.
All rights reserved.

Privacy policySitecore Trust CenterTerms of use