Sample code
// you can get the personalization ID from the dashboard
Txt.launchComponent('abcd1234', {force: false})
Use the launch component function to programmatically launch a component regardless of audience by providing the experienceId.
The component will only be shown if:
- The target page settings match the current URL of the visitor
- The state of the experience is 'live'
- The visitor is not in the control group
- The components 'Keep hidden after closing for' setting matches
If you want to make sure the component always shows, simply target all pages, set the value of 'Keep hidden after closing for' to 'never' and set the testing mode to 'no control group'.
If you want to trigger the component only by API and you never want to trigger it automatically by audiences, then simply set the target audience of the component to 'nobody'.
Txt.launchComponent(experienceId, options)
The launch component function takes the following arguments:
Argument | Type | Description |
---|---|---|
experienceId | string required | The experience ID of the component to launch. |
options | object (optional) | The options contain the following settings: force: boolean (forces to show the component regardless of settings) |