Mar 10, 20219:16 AM - edited Mar 11, 20212:43 AM
Member
Tracking Hubspot forms in Google Analytics 4 for external web pages
SOLVE
Hello, does anyone have a solution for how to track Hubspot forms in Google Analytics 4? Forms are implemented on external web pages (not Hubspot pages).
Tracking Hubspot forms in Google Analytics 4 for external web pages
SOLVE
There's 3 parts to this. Setting up that script as Custom HTML is part 1. Part 2 is setting up a trigger in GTM to listen for that event. And then step 3 is to create a Tag for your GA4 event to listen for that event trigger.
How are you tracking your form submissions today in Universal Analytics? Your forms could be getting tracked this same way through UA, but Events are just setup differently in GA4. So in UA you would have a category, action, and label to your events and in GA4 they are more flexible to be configured to your own parameters but those parameters have to be setup by you as many parts of this do not automatically populate. If this already exists, you don't need to rebuild everything different for GA4, just replace the parts that are no longer relevant. If you are not using this method today for event tracking, and are using something different we may be able to tie into that to prevent a disconnect from your old data to your new.
Feb 19, 20227:40 AM - edited Feb 19, 20227:42 AM
Contributor
Tracking Hubspot forms in Google Analytics 4 for external web pages
SOLVE
TRACKING FORM NAMES - EASIER METHOD
We can't get the name of the form. But if we listen for "onFormSubmit" instead of the 'onFormSubmitted' we can get all the fields user has filled. It seems to be a superior way. We can then create a hidden field and add the form name as the default value and track the form name without a lookup table in Google tag Manager.
Tracking Hubspot forms in Google Analytics 4 for external web pages
SOLVE
@CamiG It's a variable of type LookUp table. Input side the HubSpot Form ID. Output side a name you can assign. For example: "9373475934759379573952" -> "Newsletter signup". I assume you know how to find the Form ID.
Tracking Hubspot forms in Google Analytics 4 for external web pages
SOLVE
@birdman thanks for these instructions - super helpful. However I can't seem to get it working. I'm stuck at the same point as CamiG - creating the LookUp table. I've created the LT variable as you described but think the Input Variable value might be wrong?
@CamiG did using the value {{Form ID}} work for you? Or did you need to create a new value/variable specifically for HS form IDs? When I go to preview mode in GTM I can't see the event firing on form submission.
Tracking Hubspot forms in Google Analytics 4 for external web pages
SOLVE
Ok. I got it working. In the screenshot you see how I implemented this. Likely need to adjust for your own environment. {{LT - FormName}} is a lookup table with HubSpot formIDs.
I've managed to create the tags, trigger and variables needed, which are working correctly, but now I'd like to know which forms are submitted, and it seems that you created LT - FormName variable in order to get this information. How did you manage to create it?
Tracking Hubspot forms in Google Analytics 4 for external web pages
SOLVE
There's 3 parts to this. Setting up that script as Custom HTML is part 1. Part 2 is setting up a trigger in GTM to listen for that event. And then step 3 is to create a Tag for your GA4 event to listen for that event trigger.
How are you tracking your form submissions today in Universal Analytics? Your forms could be getting tracked this same way through UA, but Events are just setup differently in GA4. So in UA you would have a category, action, and label to your events and in GA4 they are more flexible to be configured to your own parameters but those parameters have to be setup by you as many parts of this do not automatically populate. If this already exists, you don't need to rebuild everything different for GA4, just replace the parts that are no longer relevant. If you are not using this method today for event tracking, and are using something different we may be able to tie into that to prevent a disconnect from your old data to your new.
Tracking Hubspot forms in Google Analytics 4 for external web pages
SOLVE
Looking back to your previous post, your setup appears to be correct. If the event parameters are not working, then you probably need to review your GA4 Custom Definitions to ensure that your custom dimensions are named and that their scope matches the scope of the form submission (event).