Copy-paste Google Tag Manager listeners for the forms, booking tools and contact buttons that GTM's built-in triggers miss. Each one fires only on a real success, pushes one clean dataLayer event, and comes with the trigger setup and a test checklist.
In GTM, create a Custom HTML tag and paste the listener.
Fire it on All Pages (or only the pages where the tool appears). Make sure it fires once per page.
Create a Custom Event trigger using the listener's event name (for example calendly_booked).
Attach your GA4 event (generate_lead), Google Ads conversion and Meta Lead to that trigger.
Test in GTM Preview and GA4 DebugView: one real submission should create exactly one event.
The library
Pick your tool, copy the listener
HubSpot forms
forms
Listens for HubSpot's own success messages. Keep only the block that matches your form type (legacy embed or new HubSpot forms), so one submission is never counted twice.
dataLayer event: hubspot_form_submit
<script>
// Legacy / embedded HubSpot forms
window.addEventListener('message', function (e) {
if (e.data && e.data.type === 'hsFormCallback' && e.data.eventName === 'onFormSubmitted') {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ event: 'hubspot_form_submit', form_id: e.data.id });
}
});
// New HubSpot forms (2024+)
window.addEventListener('hs-form-event:on-submission:success', function () {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ event: 'hubspot_form_submit' });
});
</script>
A small piece of JavaScript, added in Google Tag Manager as a Custom HTML tag, that listens for an event a tool sends (a form success, a booking, a click) and pushes a clean dataLayer event. GTM triggers and tags then fire from that event.
Why not use GTM's built-in Form Submission trigger?
Most modern forms submit in the background or run inside iframes, so the built-in trigger either misses them or fires on failed submissions. Listening for the tool's own success event is more reliable.
Can I use these listeners for free?
Yes. Copy them into your own or your clients' GTM containers. A link back to this page is appreciated but not required.
Do these work with Consent Mode v2?
Yes. The listeners only push dataLayer events. Whether GA4, Google Ads or Meta tags then fire is still controlled by your tags' consent settings.
Do I need one listener per page?
Fire each listener on the pages where that tool appears, or on all pages if it appears in a site-wide popup or footer. Make sure each listener tag fires only once per page, or every conversion is counted twice.
Using this library in a post, course or client handbook? Please link to jobairmahmud.com/gtm-listener-library/.