I've tried using the listenner via the dev console on google chrome and it does work for me :
I've used the listenner to push on the dataLayer the whole event data array instead of just the email.
I think the safest way for you to fix this is to get the whole data array and then have a dataLayer variable within GTM that will get the email value :
Get HubSpot form field values using Google Tag Manager (GTM)
SOLVE
Hi all,
I've found this thread while looking for a solution for our client - maybe you'll be able to help.
We have a form with a custom dropdown property with 3 options. What we would like to do is to have an Analytics Event that would fire each time the form is submitted and would save the dropdown value in Event Label.
In the past we managed to successfully set up a custom event in GTM that would fire each time a form is submitted and the Label value was the submission page. Do you have a clue what we could use as a parameter in Label so that it would pass the chosen dropdown field value? Would something like {{contact.internalname}} work? (assuming internalname is the internal name of the said field)
Get HubSpot form field values using Google Tag Manager (GTM)
SOLVE
Hey yasiooy,
If im understanding you message and images correctly your looking to grab form data and pass it through GTM into GA.
What you need is a piece of javascript running in GTM to grab the form fields on submission retain that data until confirmation is fired and then pass that data into GTM on confirmation so you can push it into GA as a custom dimension (in your case an Event Label).
It isnt as simple as picking the hs form field internal value - from my understanding. I have created some custom javascript to grab form fields to pass it into GA before, feel free to DM me.
Get HubSpot form field values using Google Tag Manager (GTM)
SOLVE
HI everyone, I know I'm late to the party, however if you want to use GTM, I finally found a video where everything works. https://youtu.be/xd-4G0VSb2Y
Get HubSpot form field values using Google Tag Manager (GTM)
SOLVE
This video only talks about pushing events to GA and pushing the Hubspot form ID. Not quite the same as collecting the data entry entered into your form fields. The trick (which took me ages to figure out) is to build the listener on the submit event to collect the field data and then you can pass it to the submitted event. Our use case was that we wanted to see if we could push the data into Google Ads to do enhanced conversions as i work for Pathfinder Marketing, a digital marketing agency. I have had a developer build a listener that does collect this data so it can be picked up by GTM and then used however you need to. I dont know about how the moderation works on these forums as i dont typically post, so i dont know if i can add my email or say msg me or what, but if your interested - msg me and if im allowed i will add my email for those who are interested 🙂 Hope that lil trick above helps all the people who are trying to code it out!
That won't work because the content of the submitted form is available within the data array only on the "onFormSubmit" event (and not onFormsubmitted).
Which means your script should include the condition event.data.eventName === 'onFormSubmit' like below :
In my case, the email was the fourth element of the form so the fourth element of the data array, hence the event.data[3].value, but you will have to adapt based on your own form.
If this still doesn't work, please do send the url of the page you're trying to track so I can have a look and give you a more precise answer.
Best,
Ludwig
Hope this helps ! If it does, please consider marking this answer as a solution 🙂
CTO @ Mi4 Hubspot Platinum Partner and Integration Expert
Passionate human, very curious about everything data and automation.
I've tried using the listenner via the dev console on google chrome and it does work for me :
I've used the listenner to push on the dataLayer the whole event data array instead of just the email.
I think the safest way for you to fix this is to get the whole data array and then have a dataLayer variable within GTM that will get the email value :
Get HubSpot form field values using Google Tag Manager (GTM)
SOLVE
Hi Ludwig - I am trying your solution to capture email and phone from form submissions. The data layer is picking up all the values from the submission, but I'm struggling to identify the right structure to pull the data layer variable name into a GTM variable.
Get HubSpot form field values using Google Tag Manager (GTM)
SOLVE
Thank you for the effort Ludwig,
unfortunately your solution proposal doesn't sove the problem. I get success event, I get guid data, but doesn't send field data or that field element value from the array (in my case its also [3]).
Get HubSpot form field values using Google Tag Manager (GTM)
SOLVE
Hi Ludwig,
This article is very helpful however i think the concern is that you are stipulating array 2 by writing event.data[3].value with the presumption that this array will always be the same field, but if you have many forms it is often not.
What could we put in the listener or probably more aptly in a piece of custom javascript variable or a datalayer variable or a javascript variable (In GTM) that says when the name = email, pull value?
I saw this: $('input[name="email"]').val() in another thread but it didnt seem to work in the listener or as a varaible.