Help with GTM trigger firing on the meeting form submit


#1

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/


#2

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


#3

Ahh that makes a lot of sense. Seems like everything I’m doing to try and
send a GA event just isn’t being recognized. I tried out a few datalayer
push code variations, but either i’m not correct with the syntax or don’t
know what I’m doing. A bit of both. :slight_smile: Thx for the reply.


#4

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


#5

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


#6

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)


#7

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


#8

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 -->

#9

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)

#10

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.


#11

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


#12

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.


#13

@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


#14

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

Thanks for updating!


#15

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?


#16

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


#17

@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.


#18

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


#19

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!