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 - If false then nothing will not be loaded

  • "widgets" - Only Widgets will automatically load

  • "surveys" - Only Surveys will automatically load

Remember, you can conditionally show a Widget, or Survey, by configuring URL and audience targeting rules (user segmentation) in the settings page. There is also a "None" Launcher option which leaves it up to you to open & close the Widget.

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