APIs & Integrations

Not applicable

Help with GTM trigger firing on the meeting form submit

Hello! We’re currenting using the Hubspot meeting form to have users signup for demos with our service. We’d like to track ‘conversions’ or essentially form submissions. I’m having trouble getting GTM setup to recognize the form submission.

I’ve tried having a GTM trigger recognize the click_class of the ‘Confirm’ button, used the form class, no luck. Any suggestions? Seems like this is compounded by the fact that the ‘Confirm’ button doesn’t highlight until the form is completely filled out.

Any suggestions or thoughts, I’d appreciate it! Read the GTM docs and everything, feel like i’m close, just can’t get the trigger to fire on the form submission.


Additionally, read some more docs and have the following embedded meeting code in my landing page. Trying to get the push to a GA event working, any help? :slight_smile:

Landing page code:

<!-- Start of Meetings Embed Script -->`
    <div class="meetings-iframe-container" data-src="https://app.hubspot.com/meetings/dan58?embed=true"></div>
    <script type="text/javascript" src="https://static.hsappstatic.net/MeetingsEmbed/ex/MeetingsEmbedCode.js">


    hbspt.forms.create({
          portalId: '2098073',
          formId: 'DEMO',
          onFormSubmit: function($form) {
              ga('send', {
                hitType: 'event',
                eventCategory: 'DEMO',
                eventAction: 'DEMOSUBMIT',
                eventLabel: 'Demo Page'
              });
          } 
    });


</script>
  <!-- End of Meetings Embed Script -->

http://try.fitli.com/demo-signup-full-gtmtest/

21 Replies 21
Gaelle-TooPixel
Member

Help with GTM trigger firing on the meeting form submit

@ChrisJustin any chance you could help me please ?

0 Upvotes
Not applicable

Help with GTM trigger firing on the meeting form submit

Hmmm...I don't see anything immediately apparent. HubSpot has since updated their software to allow for conversion tracking on the meetings tool directly, so maybe you can try that route.

0 Upvotes
antoinepotloc
Participant

Help with GTM trigger firing on the meeting form submit

@JonWeidberg @ChrisJustin Sorry for the delay guys.

This is a custom listener (a tag in GTM), it allows us to fire another tag

The trigger of the second tag (a GA event) is this:

hope it helps.

0 Upvotes
antoinepotloc
Participant

Help with GTM trigger firing on the meeting form submit

Crap, the pice of code of the first tag didn’t show up.
here’s a ps

0 Upvotes
Not applicable

Help with GTM trigger firing on the meeting form submit

Thanks for the help! Here’s the set up I used to get this to work:

// Create a Tag to load the Custom Event Listener on our scheduling pages

// Create a Custom Event Trigger when someone books a meeting

// Create a Tag for GA to count the Custom Events

That took a while to figure it, but super satisfying to see it come through. As usual, Simo’s blog (this post in particular) was also super helpful.

Thanks for the help!

Gaelle-TooPixel
Member

Help with GTM trigger firing on the meeting form submit

Hello,

Do you think this still works ?
Because I tried on this page : https://www.toopixel.swiss/contact and I can not find why that is not working.
Here is what I have done :


1- Create a Tag to load the Custom Event Listener on this page
2 - Create a Custom Event Trigger when someone books a meeting
3- Create a Tag for GA to count the Custom Events
sorry for this bad picture but as i am a new user i only can upload 1 picture and 1 link ...

Do you see where am I wrong ?

Thanks for your help

0 Upvotes
JonW
Member

Help with GTM trigger firing on the meeting form submit

Hi @Antoine_potloc , Would you be able to share the code for the custom listener and how you made it work with the hubspot hosted meeting page?

antoinepotloc
Participant

Help with GTM trigger firing on the meeting form submit

@JonWeidberg we made it (more my CTO than I to be honest), but in the end it works!
Tag-Trigger-Tag
first a tag : “custom listener” that will create an event (meeting created)

than the trigger will be fired on that event
and than GTM pass the event to GA through normal event flow

Does that make sense? am I clear enough? hope it helps

0 Upvotes
Not applicable

Help with GTM trigger firing on the meeting form submit

Would love to see your code for this as well. Struggling with the same issue.

0 Upvotes
JonW
Member

Help with GTM trigger firing on the meeting form submit

I love that you got it to work. How did you manage to fire the tag in the
iframe though?

Thanks for updating!

0 Upvotes
derekcavaliero
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Help with GTM trigger firing on the meeting form submit

You don’t want to trigger your conversion code on the forms “Button Click” as it can and will produce false positives (e.g: user clicks button and form does not submit due to invalid data but your conversion code fires anyways).

Instead, what I suggest is using a Form Submission listener setup as follows:

That will do two things:

  1. The trigger will fire when any hubspot form is submitted - you can change the trigger to only fire for a specific form by using the forms id="" attribute value and modifying your trigger fires on settings.
  2. It will make sure that the trigger only fires if the form passes validation - (NOTE: I have seen a strange issue appearing with GTM form triggers and HubSpot forms that use inline messages instead of redirects for submit actions: "Form submission canceled because the form is not connected" - console warning with embedded forms, for now the only way to avoid that issue I have found is to not use the inline message option for the HubSpot forms)
Derek Cavaliero
Director of Engineering

WebMechanix
www.webmechanix.com
0 Upvotes
JonW
Member

Help with GTM trigger firing on the meeting form submit

Thanks Derek. The issue here is that we are trying to add tracking to the meeting tool in Hubspot Sales Pro. It is different from the standard Hubspot forms. Instead of using the form builder, it uses an iFrame that is hosted on Hubspot’s domain, app.hubspot.com/meeting.

We are testing using this tool embedded in a landing page instead of a demo request form since a user could choose to set a time directly instead of the painful back and forth after a form submit. However, we need tracking for GA and conversion pixels.

0 Upvotes
antoinepotloc
Participant

Help with GTM trigger firing on the meeting form submit

Hey @JonWeidberg, your question is right on target. Have you found a solution?
Does Anybody know how to have meeting form being recognizied as event/lead/anything that can be used as a conversion?

Thanks

0 Upvotes
JonW
Member

Help with GTM trigger firing on the meeting form submit

Hi @Antoine_potloc, my only solution was to move on to other challenges with lower hanging fruit. I think this one needs development from Hubspot to move forward.

0 Upvotes
troelsfeodor
Top Contributor

Help with GTM trigger firing on the meeting form submit

Yes I made it work by editing the hubspot form embed code. Here’s how one of mine looks now:

<!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
<![endif]-->
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script>
  hbspt.forms.create({ 
    css: '',
    portalId: 'XXXXXX',
    formId: '012aaa7e-03df-4c38-83fb-63474af1c182',
    onFormSubmit: function($form) {
		window.dataLayer = window.dataLayer || [];
		
		window.dataLayer.push({
                        'event' : 'step 2',			
                        'eventCategory' : 'lead',
			    'eventAction' : 'trial step 2'
		});
	}
  });
</script>

In GTM I then created a trigger “custom event” with event name “step 2”. This is used as a firing trigger for a tag that does whatever the goal is (GA event, FB pixel conversion tag, etc)

JonW
Member

Help with GTM trigger firing on the meeting form submit

Thanks @troelsfeodor, I see how that will work for forms, but how do you use it with the meeting tool which uses the following code instead of forms.create?

<!-- Start of Meetings Embed Script -->
<div class="meetings-iframe-container" data-src="https://app.hubspot.com/meetings/[n`ame]?embed=true"></div>
<script type="text/javascript" src="https://static.hsappstatic.net/MeetingsEmbed/ex/MeetingsEmbedCode.js"></script>
<!-- End of Meetings Embed Script -->
Not applicable

Help with GTM trigger firing on the meeting form submit

Nice! Great work, i’ll have to try it out, thanks for the update!

0 Upvotes
alex
Participant

Help with GTM trigger firing on the meeting form submit

I’m having the same issue. I want to submit a FB Pixel Conversion on a Form Submit.

0 Upvotes
troelsfeodor
Top Contributor

Help with GTM trigger firing on the meeting form submit

I have the same issue. The onFormSubmit solution doesn’t work with GTM because of the way GTM renames the tracker dynamically which means it will not recognize the ga(‘send’…
So far I’ve come to the conclusion that we instead need to send data to the GTM datalayer via dataLayer.push. I’m still trying to figure out what the correct code for that looks like.
Let me know if you find a solution

0 Upvotes
JonW
Member

Help with GTM trigger firing on the meeting form submit

Any luck here? I’m facing the same issue.