Passing Form Submissions into GA through GTM as Events

jmillionaire
Level 1

Passing Form Submissions into GA through GTM as Events

I am trying to pass very specific events for "Sales Form Submit" based on MKTO form IDs through GTM into GA for conversion tracking.

 

Does anyone have a nice tutorial or example of how they have done it in the past? I have a decent solution for content form submits, but when it comes to the embedded MKTO forms on our website for inbound sales inquiries, I am seeing a huge overestimation in goal completions in GA and I think its due to the non-ideal setup.

 

@SanfordWhiteman  - I know you can help me! 

 

Attaching a couple images of how a previous digital agency set things up. I am new at the company and looking to clean things up.

 

Google Tag Manager 2021-07-14 01-01.pngGoogle Tag Manager 2021-07-14 01-01 2.png

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Passing Form Submissions into GA through GTM as Events

Wow, that code is totally wrong. 🙂 It’s adding the same event multiple times. And it’s also adding it onSubmit, when it should be onSuccess.

 

Should be like

MktoForms2.whenReady(function(mktoForm){
  mktoForm.onSuccess(function(values,thankYouURL){
    dataLayer.push({
      "event": "mkSubmit",
      "eventCallback": function () {
        document.location.href = thankYouURL;
      }
    });
    return false;
  });
});

 

jmillionaire
Level 1

Re: Passing Form Submissions into GA through GTM as Events

Thanks for the insight, Sanford. You are a legend.

 

To confirm should I edit the code to look like this in GTM?

 

jmillionaire_0-1626282512939.png