Back to Blog

How to Track HubSpot Form Conversions in GA4

PipelineOn Research Team
Blog

Key Takeaways

  • Use HubSpot’s success event for a form built in the updated editor.
  • Scope the Tag Manager trigger to the quote form you want to count.
  • Verify one accepted submission in HubSpot and one generate_lead event in GA4 when analytics consent allows.

Someone taps Request a quote on your HVAC site. If a required field is missing, the button click still happened, but the office may never get a request. For an embedded form built in HubSpot’s updated editor, tell Tag Manager to send the lead event only after HubSpot confirms the submission.

Connect the HubSpot success event to Tag Manager

Start by confirming which editor built the embedded form. HubSpot’s updated editor emits hs-form-event:on-submission:success and includes the form ID in the event. If yours is a legacy form, use HubSpot’s legacy form documentation for its callbacks. HubSpot global form events · HubSpot legacy forms

For this example, use an external website with one HubSpot quote form, a working Tag Manager container, and its Google tag. Put the listener once on the page, before the form embed. Replace the placeholder with the ID of the quote form from its embed code. The listener ignores other forms and sends only an event name to the data layer.

<script>
  window.dataLayer = window.dataLayer || [];

  window.addEventListener("hs-form-event:on-submission:success", (event) => {
    if (event.detail?.formId !== "YOUR_QUOTE_FORM_ID") return;

    window.dataLayer.push({ event: "hubspot_quote_request_success" });
  });
</script>

In Tag Manager, create a Custom Event trigger named hubspot_quote_request_success. Use it to fire a Google Analytics: GA4 Event tag with the event name generate_lead. Keep your existing analytics consent rules on the tag. Keep names, email addresses, phone numbers, job addresses, and form answers out of the data layer payload, the GA4 event, and any thank-you page URL. Google’s custom event trigger · GA4 event setup · Google Analytics data safeguards

Test one failed attempt and one accepted request

  1. Open Tag Manager Preview and use a test page or a form copy that can’t create a live dispatch. Leave a required field empty and attempt to submit. Check that the quote-success event doesn’t fire.
  2. Submit one valid request using a test contact your office controls. In HubSpot, find that exact form submission. In Preview, confirm one quote-success event and one GA4 tag fire when analytics permission allows. Open DebugView in the same GA4 property and look for the matching generate_lead event. GA4 DebugView
  3. If the submission is in HubSpot but the custom event is missing, check the embed version, listener order, and form ID. If Preview shows two lead tag fires for that one request, check your existing form and thank-you-page tags before publishing. If the tag fires in Preview but DebugView is empty, check the property, debug device, and consent state.

Once one accepted inquiry produces one lead event, decide whether to mark generate_lead as a key event for this property. HubSpot and GA4 counts can differ when analytics permission is unavailable. Use the HubSpot workflow to check what the office receives and the job record to see whether the inquiry booked.

PipelineOn

Enter your work email to get started

Already have an account? Sign in