Skip to main content
Sitecore Documentation
  • Learn
  • Downloads
  • Changelog
  • Roadmap
PersonalizeCloud Portal
Sitecore Personalize
        • Getting started
        • Using traffic allocation and variant traffic assignment
        • Target a webpage
        • Apply a condition
        • Apply a segment
        • Use a decision model
            • Use FreeMarker snippets
            • Test the API request
            • Use dynamic experiment data
            • Use dynamic guest data
            • Use dynamic decision model data
    • SitecoreAI experiments
    • Using the experiment list
    • Manage experiment details
    • Set automated post-test actions
    • Set up email notifications
    • Duplicate, delete, and view details
  • Using client-side JavaScript
  • Glossary
  1. Introduction to experiments in Sitecore Personalize
  1. Sitecore Personalize
  2. Introduction to experiments in Sitecore Personalize
  3. Introduction to web experiments in Sitecore Personalize

Compose the API request for a web experiment

When you compose the API request, you must enter the parameters that your organization's website requires in order to correctly display the offer or content. You can copy and paste dynamic data from the web experiment response into the API request. This is required if you want to use any parameters in the API request that are requested by the dependent website, such as "uri", "region", and "pointOfSale".

You can also include the offer or content returned by a decision model in the API request.

To do this, you must configure the variant to include the dynamic data so that when the variant executes, the server requests the dynamic data and passes it to your organization's website.

To compose the API request for a web experiment:

  1. In the code editor, click the API tab.

  2. Compose the API request using FreeMarker.

    Tip

    You can copy and paste dynamic data from the guest data model and decision model response, as required.

  3. You must then reference this data again by pasting it into the relevant HTML, CSS, or JavaScript editor.

  4. Click Save.

  5. Click to close the code editor.

Note

If you use an out-of-the-box web template, or if you have copied the JavaScript from such a template, you must reference an attribute from the API response within a context object. For example, to include in the CSS an imageURL from the API response, reference it as follows:

background-image: url(“{{context.imageURL}}”)
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