Skip to content

Install the widget on your website ​

Open your project in Flowtomate. In “Widget integration”, copy the installation snippet for that project. Use the script URL, public key, and API URL supplied together in that snippet. Add one tag to your website's shared template:

html
<script async
  src="https://cdn.flowtomate.com/widget/v1/widget.js"
  data-flowtomate-key="pub_live_REPLACE_WITH_YOUR_KEY"
  data-flowtomate-api="FLOWTOMATE_API_URL_FROM_YOUR_SNIPPET"></script>

Use your copied snippet in place of the example. The widget key is public and can be included in HTML. Each page should have one widget tag. On a site that changes pages without reloading, load the tag once in the shared layout.

Load order ​

A tag with async loads independently of your website's code. Access window.FlowtomateWidget after the script's load event, then wait for await window.FlowtomateWidget.ready(). In GTM, use a Custom HTML tag with an All Pages trigger and the same code. Check that another tag or template is not inserting a duplicate.

In React and Next.js, add the script once in the browser. For Next.js, use a client component:

tsx
'use client';

import { useEffect } from 'react';

export function FlowtomateScript() {
  useEffect(() => {
    if (document.querySelector('script[data-flowtomate-key]')) return;
    const script = document.createElement('script');
    script.async = true;
    script.src = 'https://cdn.flowtomate.com/widget/v1/widget.js';
    script.dataset.flowtomateKey = 'pub_live_REPLACE_WITH_YOUR_KEY';
    script.dataset.flowtomateApi = 'FLOWTOMATE_API_URL_FROM_YOUR_SNIPPET';
    document.body.append(script);
  }, []);
  return null;
}

Include the component once in the shared layout. Make API calls after the script loads.

For a plain HTML page, you can preserve the order of two scripts with defer:

html
<script defer src="https://cdn.flowtomate.com/widget/v1/widget.js"
  data-flowtomate-key="pub_live_REPLACE_WITH_YOUR_KEY"
  data-flowtomate-api="FLOWTOMATE_API_URL_FROM_YOUR_SNIPPET"></script>
<script defer src="/flowtomate-integration.js"></script>

Your developer creates the second file. The browser runs it after the widget script. Before calling methods that need loaded content, run await window.FlowtomateWidget.ready(). See the main guide for a complete example of sending IDs, email addresses, and events. An early call queue is available for commands issued before loading.

Custom button ​

In “Widget settings” → “Widget layout”, select “Custom button”. Add an attribute to a button or menu item on your website:

html
<button type="button" data-flowtomate-open>What's new</button>

The widget also finds elements added after the page loads. If it is disabled or there is nothing to show the visitor, the panel will not open.

If your website uses CSP ​

In your existing Content Security Policy, allow the script origin from the installation snippet in script-src and the API origin in connect-src. If your content loads images or media, add their actual origins to img-src and media-src. Test your published content with the resulting policy.

Verification ​

Open your website and DevTools → Network. Make sure widget.js loaded, the settings request is not blocked by CSP or CORS, and window.FlowtomateWidget is available. Run await window.FlowtomateWidget.ready(). Then return to “Widget integration”: the website address and time of the last request should appear there. ready() alone does not prove that content and visitor data loaded; check the result you need separately. If something did not work, open troubleshooting.