We had a recent project where the client wanted to embed HubSpot forms into their regular website. Why? They get your leads fed straight into HubSpot, grabbing all the useful user tracking functionality and conversion optimization tools that has made HubSpot a marketing Goliath. …But it’s never completely milk and honey. Some of the things the client wants to track are easier in Google Analytics, particularly with Google Tag Manager. Some of the key data for conversion optimization just doesn’t dovetail. After a few hundred Google searches, several failed experiments based on search results, and weeks waiting for a response from HubSpot support, we finally stitched together the solution for integrating Google Analytics event tracking in a HubSpot Form. We hope it helps someone else avoid this pain.
In the Google Tag Manager documentation, they prescribe the function you need to track the event called dataLayer.push.
If you properly connect your HubSpot form with the Google Tag Manager event, it will look like this…
You can customize the parameters in the function to track whatever events you need this way.
We hope this saves you hundreds of Google searches and all the frustration we had…
Special thanks to Rob Loveday at Champion Communications for asking the right questions and helping us chase this solution down.