Create a form for an audience template
How to create a form for an audience template, which enables marketers to configure a real-time audience without using code (Sitecore Personalize).
To further enable marketers to configure a real-time audience without using code, technical users can create forms for the marketer to complete, without ever having to edit JavaScript.
When the marketer selects the audience template to add to the experiment or experience, the form displays. All the marketer has to do is to complete the form to configure the real-time audience.
In the following image, the marketer can enter customer as the guest type to ensure that only identified guests (customers) are shown the experiment or experience.

To add configurable parameters to an audience template:
In the JavaScript editor, add the template parameter syntax to the JavaScript:
let nameParam = `[[parametername | type | value1 | {config1: value1, config2: value2 } ]]`;
The following table contains descriptions of the template parameter elements that you can add to the audience template form.
Element | Description | Required/optional |
---|---|---|
| The name of the form field that the marketer sees when they create a real-time audience based off the audience template. Example: Fare Class | Yes |
| The type of form field that determines whether the marketer enters text, a number, selects from a drop-down list, and so on. Options: string, text, number, enum | Yes |
| The default value that displays in the form field for the marketer to confirm or select from a drop-down list. | Optional, but necessary if you want to add variables that the user can select from. |
| The order in which the parameter field displays on the form. This element can be used with all the template parameters. | Optional |
| A JSON configuration object that contains name/value pairs, in relation to the | Optional |