How to Add Chat Widget Code to a Website with GTM
Create a Facebook chat widget.
To add the chat widget to a website with the help of Google Tag Manager, you will need the widget ID.
In the Google Tag Manager account, create a new tag.
Select the "Custom HTML" tag type.
Add the following script into the "HTML" field in the "Tag Configuration" form:
<script>
var body=document.getElementsByTagName('body')[0];
var script=document.createElement('script');
script.async=true;
script.src='//fbstore.sendpulse.com/loader.js';
script.setAttribute('data-sp-widget-id','YOUR WIDGET ID');
body.appendChild(script);
</script>
Where 'YOUR WIDGET ID'
is the ID which you get after generating widget code in the SendPulse service.
Configure triggers that will invoke the tag.
Save the tag.
The widget will appear on the website sometime after you submit the workspace changes in Google Tag Manager.
Last Updated: 09.08.2022
Sign up with
Sign in with Facebook Sign in with Google