Freeday widget in Google Tag Manager
- Go to your Google Tag Manager account and create a new tag.
- Select Custom HTML as the tag type.
- Paste the code below into the HTML field of the tag.
- Replace the
channelIdwith the one provided by Freeday. - 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.
- 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.