Google Analytics Event [Form Submission] overfiring compared to actuals - google-analytics

I'm running into an issue for a form submission event firing too often (200x). The trigger for the event is created from the GTM standard Trigger Type of "Form Submission" where we're checking validation and have specified the conditions to be only on the Page URL where the form exists. We've tested it in GTM preview mode and seeing that the event fires.
Update 1/28-
The form is on a pop-up through our homepage (https://mybrightwheel.com) after the user clicks on "Request a Demo" (so the event fire should not happen on this initial button click). The event fire should occur after they get into the demo request form and complete a successful form submit. And below that is a shot of the trigger. Any help here is appreciated.

That trigger hasn't specified which button it's firing on. You have 2 buttons in that screenshot, it's recording both. You need to tell it to fire on one button or the other by specifying link text or link url (i.e. where the user ends up on clicking the link)

Related

Triggering a GTM event with Mailchimp pop up form submission

I have the standard Mailchimp pop up embedded on my site. I would like to trigger a GTM event every time it's submitted to send to GA. It's an embedded iframe and I'm not seeing a way to handle this. This is the embed code for the pop up:
<script id="mcjs">!function(c,h,i,m,p){m=c.createElement(h),p=c.getElementsByTagName(h)[0],m.async=1,m.src=i,p.parentNode.insertBefore(m,p)}(document,"script","https://chimpstatic.com/mcjs-connected/js/users/xxxx/xxxx.js");</script>
I've tried reviewing the form class, form element and other form triggers, but nothing is triggering the GTM event.
GTM's "Form Submission" trigger cannot catch form submissions in (embedded) iframes.
If you are only interested in the submit, you can add a custom event listener via a "Custom HTML" tag which pushes a custom event to dataLayer which you can then act on in GTM.
document.querySelector('#PopupSignupForm_0 div.mc-modal iframe').contentDocument.querySelector('form').addEventListener('submit', function(event){dataLayer.push({event: 'mailchimp_submit'})});
This triggers every time the "subscribe" button is clicked - also when the form does not validate.
Maybe it is better to use a Timer trigger which checks for a "MCPopupSubscribed" cookie with the value "yes"?
Create a Variable "MCPopupSubscribed", 1st Party Cookie, Cookie Name: "MCPopupSubscribed", Format Value: Convert undefined to "no"
Create a Variable "TimerID", Data Layer Variable, "gtm.timerId", Version 2
Create a Trigger "Mailchimp", Timer, Event Name: "gtm.timer", Interval: 1000, Enable ...: MCPopupSubscribed does not equal yes, Fires on some timers: MCPopupSubscribed equals yes
Create your tag, fires on "Mailchimp" trigger
Create a Tag "Clear Timer", Custom HTML, fires on "Mailchimp" trigger
if ({{TimerID}}) {
window.clearInterval({{TimerID}});
}
The Timer will only "run" if the cookie is absent. It then checks every second if the cookie was set. If it is set it runs your tag and it runs "Clear Timer" to stop the timer/trigger. If it the timer is not stopped the trigger keeps firing every second.
There's also a cookie MCPopupClosed=yes which is set if the user closes the popup...

How to delay GTM tag firing?

The website has standard AddtoCart button but after clicking, user can add more units to their basket.
Problem is, AddtoCart event in dataLayer fires only once on the first clicking the button.
How can I delay firing the tag after this event so that I send final hit to GA when user is done adding units?
URL: https://shop.iglobus.cz/cz/rajata-cherry-na-stonku-strabena-250-g/8594192220046
This button:
becomes this:
Thank you.

Google Tracking Issue

I have a newsletter form on my website which is getting track on every hit of submit button. But now I recognize that if I simply hit submit button without filling any email than also it get track by GA code.
I want my newsletter form should only be tracked on successful submission and not on any blank submission.
You need to bind your event tracking to a successful form submission. It sounds like you are currently binding it to the click event on the submit button.
Start by getting your tracking event bound to submit event of the form (and not click event of the button) and then you'll have to write some code to find out when the form submission is valid.
Without further information about you page construction no-one can help any more than this.

OnButtonCLick tag is not firing?

I have defined a trigger having event name as "gtmEvent" and a tag "AccountCreated". When I click on a button ("createAccount") it goes to next page. But tag is not fired and also in summary the event is not listed but when i check google analytics through console i found that tag is there in event name.
Is it when you click on page and after clicking you stayed at same page only then the event listed on summary otherwise it will lost. ??

Google Tag Manager's gtm.formSubmit not firing for AJAX forms

When I create a tag to listen for form submissions using Google Tag Manager.
For my ajax submitted form which does not go to a new page, the submission of a form does not fire the gtm.formSubmit event into the data layer.
What should I do instead?
I need a "codeless" solution to detect form submission and to capture the submitted values.
I ran into another potential reason for this as well and thought I'd drop it in here.
In the Form Submit Listener, you need to have Check Validation unticked for AJAX forms (if the Submit button is blocked from doing a normal submit, as you would do with AJAX forms, this option blocks the listener from firing the correct event).
I have an ajax submitted form and the formSubmit click listener and event tags are working for me.
You might be doing this already, but just to double check;
You are adding 2 tags - the formSubmit listener and the Analytics event tag for that event?
Are you setting up the filters correctly (i.e. including event equals gtm.formSubmit, and the appropriate page?)
If it still isn't working, another suggestion is to use a simple click listener, then filter for both the page the form is on and the id of the submit button.
Here is how Google recommends doing it.
Add a basic page tracking tag (i.e. Tag Type of Google Analytics or Universal Analytics; Track Type of Page View) if you don't already have one. This tag must fire on all pages.
Add a tag of type Event Listener > Form Submit Listener. You can name it “Form Submit Listener”. Add a single firing rule of "All pages", or, for the specific page(s) on which you want to listen for form submissions.
Add a rule (named "Form Submit" for example) with the following condition:
{{event}} equals gtm.formSubmit
Add an Analytics event tracking tag (i.e. Tag Type of Google Analytics or Universal Analytics; Track Type of Event). Add the rule you created in the previous step as the firing rule (for example, "Form Submit"). Enter a Category, Action, and and Label for the event. For example, you might use the following:
Category "Forms"
Action "Submit"
Label "Lead Gen".
Save a version of the container and publish it.

Resources