Skip to main content
Users
CloudPortalLogin
  • Powered byPowered by
Introduction to Sitecore Personalize
Managing accounts and system settings
Identifying guests
Introduction to experiments
Introduction to experiences
Decisioning
View dashboards
Developer Center
Connecting to an external system
Using client-side JavaScript
Using server-side JavaScript
AI in Personalize
Glossary
  • Sitecore Personalize
  • Introduction to experiments in Sitecore Personalize
  • Introduction to web experiments in Sitecore Personalize
  • Compose the API request for a web experiment

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:

RequestResponse
background-image: url(“{{context.imageURL}}”)

Do you have some feedback for us?

If you have suggestions for improving this article,

Privacy policySitecore Trust CenterCopyright © 1999-2025 Sitecore