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.
Related
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)
I had a website where there was a link to a hotel booking engine and had been using onSubmit to record a form submission as an event.
However it didn't seem to be recording properly - the figures were too low.
So, I thought that maybe changing to onClick would help - so the code on the form would look like this:
<form id="bookingEngine"
class="bookingEngine"
name="bookingEngine"
action="redirect.php"
method=POST
target="_blank"
onClick="ga('send', 'event', 'Booking', 'Website');
">
This works, except now the figures are much higherand look as if maybe overreporting?
Is this right, could the onClick on a form tag be recording something other than the number of forms submitted?
A more simplistic explanation would be that the onclick tracks when an element is clicked, regardless of the outcome or the context in which the element was clicked, whereas the onbusmit tracks when a form button is clicked and the form successfully submitted. So if there were errors in the form that invalidated the form, and it doesn't get submitted, then the onsubmit action would not occur.
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.
I have a third party form that I can't control. I'm putting that form on my webpage via an iFrame. I am then trying to redirect that iFrame to a new page after the form has been submitted.
Example:
User visits my webpage. They enter their email in the web-form. They then hit submit. The iFrame is redirected to a page that displays "Thanks for confirming your email!" etc..
Essentially after they enter their email I want that iFrame to redirect to a different page. I don't know how to do it because I don't control the form. I was thinking maybe adding a button or function when they hit enter or click submit that it submits the form then after a set amount of time it r
This is considered cross site scripting http://en.wikipedia.org/wiki/Cross-site_scripting so I'm not sure if it will work. Maybe you could open the subscribe form in a modal(like this http://colorpowered.com/colorbox/) and then the user will close the modal when he wants.
On one of my ASP.NET pages I have several asp:textbox fields. On this page there is a "confirm order" button with an external url set in its "PostBackUrl" property.
This works well, and the data is sent to the external site. Here comes the question; how do I know that the user clicked the "confirm order" button on "my side?" (I need this to update my order-status field). There is off course no postback happening on my page becasue the form is submitted to the external site.
Maybe it's possible to use some sort of jQuery to hook on the onclick-event that will call a page that will update my order-status?
You'll need to hook into the buttons onClick event, perform a client-side callback to either a web service or Page Method (depending on your preferred setup) on your server to track the click, before allowing the form submission to continue.
Better to set it up so that the button does perform a postback. Then in your click handler you can update your order-status, and then post the data to the third party.