Use dynamic guest data in the API request for a web experiment
You can copy attributes or paths from the guest data model and use them in the API request.
To include dynamic guest data in the API request:
-
In the code editor, click the API tab.
-
On the Data tab, in the Data selector search box, enter a guest's email address to search. This enables you to access data model attributes and paths.
TipIf there is a guest whose data you often use when configuring or testing code, click the star icon to bookmark the guest so you no longer have to search for them.
-
Under Guest data model, click next to the attribute or path and click Copy Path as FreeMarker.
-
Paste into the API tab.
TipThere are some situations when you might want to insert a custom field in your API request, using FreeMarker. For example, you might want to retrieve the logged in state of the site visitor. To do this, you can create a custom field called
loggedInState
. You can then use the following path in FreeMarker when configuring the API request:"customField": "${request.params.customField}"
-
You must then reference this data again by pasting it into the relevant HTML, CSS, or JavaScript editor.
-
Click Save.
-
Click to close the code editor.