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 -
Do Lot of Tracking via Tag manager Increase Bounce Rate?
Hello Expert, I am doing lots of tracking for my ecommerce site but I am not sure reason for increase in bounce rate as my traffic also increase but I want to make sure that my tracking not affecting my bounce rate. I do tracking via page views, events, custom html, etc so for all the applicable tags Non-Interaction Hit - I set "True" so I am right here? Thanks!
Reporting & Analytics | | dsouzac0 -
How to track in google analytic which filters selected in which category?
Hi All, Can anyone tell me how to track which filters selected in which category like in category I have 1) price ( then different - different price) 2) color ( then difference - difference colors) same for size, width, brand etc. Is it possible to track in detail via tag manager? Other than tag manager what are the best way to track filters? Please explain me technical guidance too. Thanks!
Reporting & Analytics | | adamjack0 -
Is It Possible to have Cross Domain Tracking on Two Different Accounts?
Good afternoon to all, I have this kind of dilemma regarding setting up tracking code on two different accounts, namely bioglass.com with GA Code UA-12345678-1 where all the product information has been listed and shopbioglass.com with GA Code UA-87654321-1 where the prices are located and transaction takes place. Both of them are connected since if you click the buy button on bioglass.com for a specific product, it will automatically redirect to shopbioglass.com where the prices and transactions comes into place. Dilemma: I want to check how many conversion took place from bioglass.com to shopbioglass.com. I know they have different GA Code but is it possible for me to have a cross domain tracking for this?? What are the possible remedies if not? Thanks to all 🙂
Reporting & Analytics | | TWSOM0 -
Weird Math in GA Ecommerce Tracking
Hi everybody. I've recently discovered that I have a problem with the ecommerce tracking on a client's website. The client sells concert tickets at an average price of $10 per ticket. The custom ecommerce platform they use is kind of unusual; the same product often has different SKUs, but not always. This isn't associated with different seats, etc. In fact, I don't yet know why they've set it up that way. The problem that I'm facing is this: the data in Analytics is calculating the "average price" of a SKU item as the total price. If, for example, the actual average price for a SKU item is $10 and four of those SKU items were sold, Analytics will tell me the average price is $40. This means that the total revenue for that SKU shows up as $40 x 4 = $160. Needless to say, this is enormously skewing the data. Here's a screenshot. Note, it's the same product: http://screencast.com/t/JyLQkb3jzz6s The total revenue for ticket sales is way off because of this, and I'm not sure if it's a problem with the ecommerce tracking code in Analytics, or something that the ecomm platform is doing. Have any of you experienced anything like this, and if so is it a fix in Analytics? Thank you!
Reporting & Analytics | | newwhy0 -
Procedure of ecommerce tracking installation and set-up using GTM
Hello Experts, I have an e-commerce website. Google Analytic configured in Google Tag manager. Now in google analytic I have "ON" the Enable Ecommerce. Now i have to do ecommerce tracking installation and set-up? So can you please let me know the procedure? Regards, Jackin
Reporting & Analytics | | jackinmathis10 -
Cross domain tracking setup in Google Analytics
I really need help on this, I can't figure it out. I need to track a few subdomains and and couple of seperate domains in one profile in Google Analytics. So I have: www.maindomain.co.uk sub1.maindomain.co.uk sub2.maindomain.co.uk www.anotherdomain.co.uk So the code I have placed on all of these domains is as following: I have then set up seperate profiles which filter out the data by domain. E.g. for sub1.maindomain.co.uk, I have user the fitler: Custom filter > Include > Filter Field = Hostname > Filter Pattern = sub1.maindomain.co.uk For the www.anotherdomain.co.uk, I have used the same filter. Now this all seems to be tracking visits and unique visitors okay, but I always have a very low pageview count, less than visits and sometimes zero. Could anyone shed any light on what I am doing wrong? Thanks in advance mozzers.
Reporting & Analytics | | MirandaP0 -
Track Google/Bing Shopping as Referrer
Is there a way to track Google & Bing Shopping referrals independent of standard Google/Bing tracking? It would be nice if we could see the difference between Google PPC, Google Organic & Google Shopping. I notice in analytics that we get some traffic from google/ppc, some from google/organic, some from google.com/referral (not sure what this is), and some from googlebase/cse (I know this is Google shopping, but I don't think it's tracking all shopping referral visits as this).
Reporting & Analytics | | JerDoggMckoy0