Tracking forms in GTM

Hi,
I’ve successfully set up HubSpot tracking in Google Tag Manager based on this guide: Track Hubspot Form Submissions with Google Tag Manager and Analytics | NettlesNET
The problem is that all forms are tracked with this solution, and I only want to track some forms in Google Tag Manager - or to leave out tracking on some forms (I don’t want data from all forms send to e.g. Google Ads). The dream is also to avoid setting up URL tracking. What can I do?

Hi @AChristensen2,

Thanks for reaching out!

I would like to invite some experts to our conversation.

Hi @Ben_M, @danmoyle, @Aakar, @Mike_Eastwood - Do you have any recommendations for @AChristensen2?

Thank you!

Best,

Kristen

I’m not sure I’m following your dream scenario to avoid setting up URL tracking. If you are talking about UTM, that is more about managing campaigns and dissecting your traffic that leads to the submission.

With regards to the forms setup, I usually recommend that you setup triggers that look for the hubspot-form-success event name and have that trigger only fire on the hs-form-guid which is the ID of your form that is found in the source code when you embed the form. Then setup a tag that fires a google analytics event when a submission happens with that particular ID, or set of IDs if you setup multiple triggers.

I used this solution:- Track HubSpot Form Submissions in Google Tag Manager and GA4
You can then use the Page Path Event Parameter {{Page URL}} to filter the forms your interested in.

Thank you for answering!
We have a lot of different forms and are constantly adding new forms to the website, so I would like a solution which listens after some kind of identifyer, so I don’t have to constantly change the tracking, hence adding new form ids. Is it possible? Can I add some kind of identifyer to the form in HubSpot or is there another solution?


@AChristensen2 wrote:

Thank you for answering!
We have a lot of different forms and are constantly adding new forms to the website, so I would like a solution which listens after some kind of identifyer, so I don’t have to constantly change the tracking, hence adding new form ids. Is it possible? Can I add some kind of identifyer to the form in HubSpot or is there another solution?


Unfortunately if you only want to capture some forms as you have mentioned, then you will have to set this up on a case by case basis where you want to track the forms. Otherwise you would setup tracking to look at all form submission events. You could capture the hs-form-guid to populate an event parameter and then use Google Data Studio to show reporting per form or if you want to use a form across multiple pages, you could also use the event parameters to capture the URL or other pieces of information to dissect in Data Studio.

Ya, I’ve been in this scenario. I made a video on it, and for the trigger use the page path if you only want to trigger certain pages with the form.

Hi @Revvmarketing,

Thank you for this contribution!

@AChristensen2 check out this video how-to guide from @Revvmarketing :slightly_smiling_face:

Best,

Kristen

Hey there, I’ve been having a similar issue where I installed the tracking code in my GTM, used to work but the whole website got revamped and I can’t seem to catch an “onFormSubmitted” event anymore. I will attach my web tag as well as the short code used in elementor of my wordpress website

@kvlschaefer @Ben_M any insights?

@cyammine - Your issue seems to be different from the original poster who was selectively trying to capture forms via GTM. As yours is not capturing at all, I would recommend you create a new post with your issue as opposed to posting in one marked as answered so that all members of the community can help out and offer advice as most will not respond to new replies in an answered thread. Also I would recommend you post a link to the page in question as the only way to troubleshoot this initially would be to inspect the page for any runtime errors that may be occuring.

However, if the tag is not firing at all, I would likely recommend in this instance to utilize the testing mode of GTM to see if the tag is indeed firing and if it is not that tool would be the best to determine which code is not firing and it should provide the answers or some insights as to why.

I faced the same issue, and solved it writing a Hubspot Form Listener in javascript that gives you the form_id parameter. Then inside Google Tag Manager you can add conditions in your trigger based on the form_id dataLayer variable.

To help people in the same situation, I posted a blog post about it.