Manual loading
If you want to manually/conditionally load a Widget (or Survey) you still need to call Frill('container')
as early as possible.
Disable auto loading
You can control/disable automatic loading of Widgets & Surveys when you call the container
command with the autoLoad
option.
window.Frill('container', {
key: 'YOUR_SCRIPT_KEY',
// Pass false to disable automatic Widget and Survey loading
autoLoad: false, // Also accepts: 'widgets' or 'surveys'
});
The autoLoad
option accepts:
boolean
- Iffalse
then nothing will not be loaded"widgets"
- Only Widgets will automatically load"surveys"
- Only Surveys will automatically load
When you're ready to show the Widget, call the widget
command with the Widget Key.
const widget = await window.Frill('widget', {
key: 'YOUR_WIDGET_KEY', // <-- Add Widget key here
callbacks: {
onReady(widget) {
// Optional callback if you prefer this syntax
console.log(widget);
},
},
});
Last updated