Form submission event does not get triggered in GTM


#1

Hi,

I am trying to implement a facebook pixel standard event fbq('track', 'Lead'); using GTM. And I want the form submission, and a lead flow submission (the lead flow we can ignore for now) as a trigger for this.

I created a form submission event https://app.hubspot.com/analytics/2360446/events/000006483908/edit
and used it as trigger in GTM. But it doesn't get triggered.

I see there is no hubspot ID in my tag and that can be the problem, but my tag in this case has to be fb pixel.

(you find the details in the screenshots)

I appreciate any help.

Thanks,
Bahar


#3

Hi @Bahar,

Could you simplify matters and add the fbq('track', 'Lead') snippet to your form's embed code on this page? You can place the snippet within the onFormSubmit event described here. For example:

<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script>
  hbspt.forms.create({
    portalId: "XXXXXXX",
    formId: "da8babf2-bb8e-468f-a33d-2c37ae89de6c",
    onFormSubmit: function($form) {
      fbq('track', 'Lead');
    }
  });
</script>

You can install the Facebook Pixel base code across your site or specific subdomains by following these steps. That way, you only need to fire fbq('track', 'Lead').