Want to track AJAX form submits. Is this correct?
-
Hi!
I would like to track everytime a visitor clicks a AJAX contact form's submit button. I created an event in Google Analytics and plan to add some javascript to the submit button code.
This is the current submit button code:
This is how it'll look after I add the category, action, etc.:
Is this correct or am I missing something? Please let me know if you need further detail.
Thanks a lot!
-
That looks good to me. If you are unaware, once you get that event tracking properly, you can also setup conversion goals in GA which are triggered by custom events.
-
Hi Benjamin,
Thanks for taking the time to reply.
I posted my question 4 days ago and frankly had lost all hope for a reply so I asked in another forum and got the same recommendation. So I added the GA category, action, etc to the javascript validation section as you can see belowsuccess: function(data){ if(data == 'true'){ jQuery('input, select, textarea', form).val('').css({'background-position': '5px 9px'}); jQuery(message).html('Message sent.'); _gaq.push(['_trackEvent', 'Contact', 'Inquiry', 'Inquiry Form', 0, false]); }}
I'm waiting for the developer to implement this and see if it works.Well, thanks again and if you have further comments they're are more than welcome
-
Hi Alfredo,
Your syntax there all looks correct.
I'd recommend though, if it's possible, to instead trigger the event after the form submission has gone through. In your code above, the event will trigger whether or not the submission goes through, so if the user gets stopped by validation or something, it'll still count as a submission.
In any case, what you have above is correct.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Would updating Meta Titles affect Google analytics tracking?
Hi All, I need a little bit of help. We need to optimize our blog's articles Meta titles for SEO which all exceed 100 characters. I was told that if we change the titles, google analytics would split the tracking pages and count the data as 2 pages (old title and new title). Has any of you have this experience before and if so, is there a way to avoid google analytics counting this as two pages? Thanks in advance! Viviana http://analyteguru.com/ http://analyteguru.com/ http://analyteguru.com/
Reporting & Analytics | | mchoi0 -
Submitting an 'HTTPS' sitemap.xml to Bing
I have been trying to submit my sitemap to Bing [via their webmaster tools] for well over a week and it continues to report 'pending' My site is HTTPS and the sitemap is accepted by Google. I questioned Bing about this and got this response: To set your expectations, our Sitemap fetchers use a different pipeline and because of this, we cannot crawl Sitemaps in HTTPS format. We require that you submit an HTTP version of sitemap in order for Bing to properly crawl the file. Please go ahead and delete the current Sitemap and resubmit a new one in HTTP. Currently I don't and can't have a HTTP version of my site & sitemap and my developers are telling me that 3hrs worth of dev time will go into coming up with a work-around which I'm not sure I want to invest in [I have more important things to concentrate my spend on!]. Has anyone been faced with this problem and is there any quick/cheap alternative or do I just accept that Bing won't crawl my site until they update their end?!
Reporting & Analytics | | cityxplora.com0 -
Goal Tracking In Analytics On Separate Ordering Website
I have a question for any Google Analytics wizards out there. We have two clients that have a similar complication when it comes to tracking goal conversions in Analytics. Basically, all the conversion actions we want to track occur on a separate website; either an iframe embedded on the page or through an entirely different ordering website. Trick is, Analytics sees the source for all these conversions as referrals from the main site. We'd like to get visibility back to the original source/medium that brought visitors to the site before they converted. Anyone have a suggestion for making that happen?
Reporting & Analytics | | fivefifty0 -
Tracking Mailto Links Through Event Tracking
Hi I am trying to get event tracking working on some mailto links on a website using Universal Analytics. I've read various resources as nothing seems to mention mailto links. Does it not work on tracking outbound clicks on emails? Thanks in advance.
Reporting & Analytics | | Karen_Dauncey0 -
Why seomoz shows me "missing meta discription" on this plugin: http://villasdiani.com/wp-content/plugins/dopbsp/frontend-ajax.php ? Should I edit? how?? IIs it posible??
Good day to all! I am very confuse about results on seomoz Crawl Diagnostics Summary, especially with 6 Crawl Warnings Found. It says title too short: http://villasdiani.com/category/mombasa/, http://villasdiani.com/category/watamu/ , http://villasdiani.com/sitemap/ why would Google punish me for this??? why should I make longer title for sitemap? or Watamu? It is the name of the place - Watamu or Mombasa. It is very confusing for me. I have very big mess with the website and it is not ranking:-( what I have done:-( and is it possible to meta description for this plugin: http://villasdiani.com/wp-content/plugins/dopbsp/frontend-ajax.php how?? I even do not know where is it.
Reporting & Analytics | | VillasDiani0 -
Call Tracking Services - Canada
Does anyone have any recommendations for call tracking services that service Canada? If so, have you used them personally? Was set up difficult?
Reporting & Analytics | | Stevej240 -
Want to link to GA profile, but the one I want is not showing in drop-down
How can I manually add the correct Google Analytics data in to my account? The two options I see on the drop-down are not the ones I want to select and I don't see a way to do it manually. Help!
Reporting & Analytics | | Uniqueson0 -
Tracking SEO tests
Trying to get some best practices on testing SEO changes. We are going to make a bunch of changes on subsets of pages. Say testing about 5 different on-page changes. Originally we were going to submit separate Sitemaps to GWT and see if our test sets get indexed, how quickly, etc. But we noticed that GWT says some pages in our Sitemaps aren't indexed even though we know they are (what gives?). So we thought, for each test, let's put a unique code on the page so we can see how many get indexed by Google. But that doesn't solve the issue: how many people clicked on our test pages. So we are thinking of putting a tracking pixel on the test pages, specific for each test. But then I am thinking, why not just create a separate Google Analytics profile and place that code on the test pages (set up goals to track visits per test since we aren't going to change the actual URLs). and on and on This is where you come in. What kind of tracking do you implement when you set up tests? Advice appreciated! E
Reporting & Analytics | | ErinTM0