GoHighLevel form tracking with GTM, GA4, Google Ads

GoHighLevel is getting more popular every day. It comes with a built-in website builder, lead forms, and a meeting booking form.

However, tracking GoHighLevel forms can be tricky — especially because the forms are embedded as iFrames. The challenge becomes even bigger when you need to track form submissions along with user input values for Enhanced Conversions.

To help you solve this, I’ve written a simple but powerful tracking code that works perfectly with Google Tag Manager (GTM).

✅ It pushes the form submission event and user input values to the GTM dataLayer
✅ Works with both lead forms and booking forms

Just copy the code below and use it as a GTM listener script for GoHighLevel form tracking.
You can also follow the video below for the full setup and walkthrough. 🎥👇

<script>
/**
* Author: Md Hasanuzzamna
* Linkedin: https://linkedin.com/in/md-h
* Youtube: https://youtube.com/@leomeasure
* Email: info@leomeasure.com
*/
(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>

Leave a Comment

Your email address will not be published. Required fields are marked *

Get A Quote

Please contact us for expert guidance & personalized solutions to maximizing the potential of Google Analytics for your business.

Send Us A Message

    Contact Us

    Please contact us for expert guidance & personalized solutions to maximizing the potential of Google Analytics for your business.

    Send Us A Message