If you’re running Go High Level forms and want to track conversions in Google Analytics or Facebook Ads, here’s how to do it with Google Tag Manager.
What This Does
This event listener catches when someone submits a GHL form or completes a booking, then pushes that info to your dataLayer so you can track it as a conversion.
The Event Listener Code
<script>
(function(){
var formData={};
window.addEventListener('message',function(event){
if(Object.prototype.toString.call(event.data)==='[object Array]'){
var formJSON=event.data[2];
if(formJSON&&typeof formJSON==='string'){
try{
var formObject=JSON.parse(formJSON);
if(formObject.email||formObject.name||formObject.phone){
formData=formObject;
window.dataLayer=window.dataLayer||[];
window.dataLayer.push({event:'ghl_form_submission',formData:formObject,formOrigin:event.origin});
}
}catch(e){}
}
var eventType=event.data[0];
if(eventType==='booking-complete'||eventType==='form-complete'){
window.dataLayer=window.dataLayer||[];
window.dataLayer.push({event:'ghl_calender_submit',bookingData:formData,eventOrigin:event.origin});
}
}
},false);
})();
</script>JavaScriptAlternative GHL Event Listener Code
<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>JavaScriptThis tracks two events: ghl_form_submit when a form is submitted, and ghl_booking_complete when a booking happens.
Video Tutorial Coming Soon
How to Set It Up
1. Add the Listener to GTM
In Google Tag Manager, create a new Custom HTML tag, paste the code above, and set it to trigger on All Pages (or just pages with your GHL forms). Save it.
2. Create Event Triggers
Go to Triggers and create two custom event triggers:
- One for
ghl_form_submit - One for
ghl_booking_complete
3. Fire Your Conversion Tags
Now use these triggers on whatever tags you want to fire – Google Analytics events, Facebook Pixel, Google Ads conversions, whatever you’re using.
For example, if you’re tracking with GA4, create a GA4 Event tag, set the event name to something like “form_submission”, and use the ghl_form_submit trigger.
Grab Form Data (Optional)
The listener captures form fields like name, email, and address. To use this data, create Data Layer Variables in GTM:
- Variable name:
inputs.full_namefor the customer’s name - Variable name:
inputs.emailfor their email - Variable name:
inputs.customer_idfor the customer ID
You can then pass these to your marketing tags if needed.
Quick Tips
Testing: Use GTM’s Preview Mode before publishing. Submit a test form and make sure the events show up in the dataLayer and your tags fire.
Privacy: Make sure you’re only tracking people who’ve given consent. Add consent checks to your triggers if you need to.
Troubleshooting: If events aren’t firing, check your browser console for errors and verify the listener tag fired on page load.
That’s it. Once you publish your GTM container, you’ll start tracking GHL form submissions as conversions.

0 Comments