RESOURCES/GOHIGHLEVEL LISTENER

GoHighLevel form and booking listener for Google Tag Manager

GoHighLevel forms, surveys and calendars are embedded as iframes, so GTM cannot see completions natively. This listener catches GHL's postMessages and pushes ghl_form_submit with the submitted field data, and ghl_booking_complete when a calendar booking finishes, so you can fire GA4, Meta or Google Ads tags on real conversions.
ghl-listener.html
<script>
(function() {
  var inputData = {};
  window.addEventListener('message', function (event) {
    if(Object.prototype.toString.call(event.data) === '[object Array]') {
        var inputJSON = event.data[2];
        if(inputJSON && inputJSON.includes('full_address') && inputJSON.includes('customer_id') && inputJSON.includes('full_name') && inputJSON.includes('email')) {
            var inputObject = JSON.parse(inputJSON);
            inputData = inputObject
            dataLayer.push({
                event: 'ghl_form_submit',
                inputs: inputObject
            });
        }
        if(event.data[0] === 'msgsndr-booking-complete') {
            dataLayer.push({
                event: 'ghl_booking_complete',
                inputs: inputData
            });
        }
    }
  });
})();
</script>

Install in 3 steps

  1. 01

    In GTM, create a Custom HTML tag and paste this code.

  2. 02

    Set the trigger to All Pages, or only the pages where the form is embedded.

  3. 03

    Open GTM Preview, submit a test form, and confirm the event appears in the dataLayer. Then use that event as the trigger for your GA4, Meta, or Google Ads tags.

Common problems

More free listeners:Typeform · Calendly · HubSpot

Want your whole tracking setup done properly?

Book a free 15 minute tracking audit.

Book a free call