Freeday widget in Google Tag Manager

  1. Go to your Google Tag Manager account and create a new tag.
  2. Select Custom HTML as the tag type.
  3. Paste the code below into the HTML field of the tag.
  4. Replace the channelId with the one provided by Freeday.
  5. Set the triggers for when you want the chat widget to appear — for example, on all pages, on specific pages, or after a specific action.
  6. Save your changes and publish the container.
<script type="text/gtmscript">
  async function loadFreeday() {
    const channelId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
    const response = await fetch(`https://api.freeday.ai/webchat/v1/widget/${channelId}`);
    const freedayConfiguration = await response.json();
    const freedayWidget = await import(freedayConfiguration.cdnUrl);
    freedayWidget.bootstrap(freedayConfiguration);
  }
  loadFreeday();
</script>

Once published, the Freeday chat widget appears on your website and users can interact with you via chat. Test your changes to make sure everything works correctly.