Google Analytics Custom Event Track for Lead Flows



Looking to see if there’s any way to track lead flows as a custom event in Google Analytics?

Some of the Lead Flows are on external pages. We do not have the events tool within HubSpot.

If there is not a direct solution, is there a workaround?


I would also like to learn about this - scripts inserted in the lead flow thankyou message are rendered as rich text. Tracking this seems fairly bread and butter…


Has anyone found a solution to custom event tracking for lead flows?


For lead flows:

window.addEventListener('message', event => {
    // Check if the event was sent by Hubspot
    if( && {

        // Trigger the event to Google Analytics
        ga('send', 'event', 'Form', 'send', 'Hubspot form');