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
-
Tracking PDF downloads from SERP clicks
For the longest time, our company policy has always been to put PDFs in a secure folder (hence they are not indexed and do not appear in search results). After evaluating this strategy, there has been clamor in recent months to allow Google to index our whitepapers. My question: Once PDFs start appearing in search results, what is the best way to start tracking clicks due to these "downloads"?
Reporting & Analytics | | marshdigitalmarketing0 -
How to trigger a pageview using Google Analytics API upon form submission
I need to set up a goal using the G A API to trigger a pageview when someone submits a lead on my site. There's no "thank you"page currently. How do I go about it? There's no "thank you"page currently. How do I go about it? I have never used the API but am very familiar with analytics. Thanks!
Reporting & Analytics | | Majsan0 -
Google Shopping tracking as organic traffic - help!
Hey guys, I have an eCommerce client who sometimes runs Google PLA and Google Shopping campaigns. However, we don't run his AdWords for him, just do his SEO. At the moment, the Shopping campaigns track as organic traffic within Analytics. And I can't see any way to change this! It's so infuriating. How do I change this? Thanks!
Reporting & Analytics | | jasarrow0 -
Universal Analytics Ecommerce Tracking in Magento
We have a problem similar to this: http://stackoverflow.com/questions/22229312/universal-analytics-could-not-track-transaction-in-magento On a client's website. I need an absolute knock-out EXPERT at solving this to give us a quote on doing something like this. It's very urgent but it is paid. Basically the site used the old tracking code, worked, then client said they wanted new data so we upgraded to Universal. Now everything works but Ecommerce tracking. Desperately need help! Thanks all!
Reporting & Analytics | | MattAntonino0 -
Virtual Pageviews vs. Destination URL for Goal tracking
I am working on setting up goal tracking. Currently when we receive a new signup, the person gets sent to their dashboard homepage and this is not a valuable a goal tracking destination. My suggestion was to build a "Welcome" interstitial page to send a user to when they create an account. Our tech team suggested using a Virtual pageview instead as it is their thinking that a "Welcome" page adds little value. Is there any downside to using Virtual Pageviews with regards to goal tracking?
Reporting & Analytics | | Vacatia_SEO
Are interstitial page more reliable?
Can you still use funnel visualization with Virtual Pageviews?0 -
Multiple-Domain tracking for sister sites- NO retail checkout- Please help
Hello, I have about 5 sites I want to set up multiple-domain tracking in google analytics. All posts I read seem to be focused on cross-domain tracking for the purpose of tracking a visitor from one domain across another domain for shopping cart check outs. I don't need that. I have about 3 sister sites (mastersite.com, sistersite1.com, sistersite2.com, sistersite3.com) related to my primary site. I want 1 Master Analytics Profile to track traffic for all of these sites combined. My visitors will not jump from mastersite.com over to sistersite1.com. There will be no cross-domain visits. How can I set up 1 master google analytics profile that will aggregate traffic data from all sites and present the data to me in one analytics profile. Please help
Reporting & Analytics | | AndreGant0 -
Cover my tracks / two websites on the same Analytics
Hi, I've got 2 websites and I like one of them to make some links to the other one. These two sites are on the same Google Analytics account. They have been set up 3 month ago and they have some articles on them. I've heard that Google can see that those websites are related in my Analytics and use this information to give less power to the link I could make between them. What do think about it and what do you recommend me ? Shoud I closed the Analytics account ? Or down one of the website and rebuilt it whith a different domain / host / analytics ? The thing is if I delete one of the website i'll be force to republish the articles, because there are links on it, and they're part of a deal I've already made. Thank you
Reporting & Analytics | | Spleen0 -
Tracking Email campaign
I generated the following URL to track visits from newsletter. http://www.example.com/ ?utm_source=newsletter1&utm_medium=email&utm_campaign=newletter2109 Do i have to use this link in our email ? My question is it looks ugly. How do i shorten this ? Using bit.ly ? But isn't it true that URL shortening services such as bitly, as some can increase the likelihood of email being marked as spam
Reporting & Analytics | | seoug_20051