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.
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
-
How to do Conversion Tracking for Homepage banners?
Hello All, I want to do banner conversion tracking for my ecommerce site. That is at my homepage I display 4 banners with special offers on 4 different products. Now that 4 products are already falls in relevant categories. I did event tracking for banners from where I can know how many clicks I am getting from each banner but My Query is how to know conversion of all 4 banner products because once I create goal that is funnel like 1) home page 2) product page 3) checkout step 4) Thank you page. But problem comes here is if anyone purchase these product from categories that also comes in goal so how to differentiate conversion of products from homepage and category pages? Is there any implementation via enhance ecommerce? Hope you understand my query? If any confusion do let me know. Thanks!
Reporting & Analytics | | micey1230 -
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 -
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 -
Difference between Enhance Ecommerce & Event Tracking ?
Hello guys, Difference between Enhance Ecommerce & Event Tracking ? If i implement Enhance Ecommerce then no need to configure event tracking? Thanks!
Reporting & Analytics | | bkmitesh1 -
Cross-Domain Tracking Urgent Query :-(
Hi Mozzers! One of my clients is having an issue with cross-domain tracking, in other words their own domain is seen as a huge referrer. When you land on their site, which is www.sunway.ie, and then choose a holiday to book it then takes you to another domain which is www.sunwayholidays.ie, during the booking process. I'm just wondering if there is a Google Analytics genius out there who may be able to take a quick look and let me know if there is any obvious solution to this within the Google Analytics code? Thanks in advance everyone! Gavin
Reporting & Analytics | | strategemilabs0 -
Cross Domain Tracking
I want to track across domains, but also track as a virtual pageview anytime someone clicks on the link to another domain. So currently I have, for example: Checkout Now! As per Google's instructions, I need to have the link set to: Checkout Now! But this will obviously get rid of my virtual pageview. Is there a way I can do both?
Reporting & Analytics | | TeachersMutualBank0 -
Need Tips to Track Advertising of Domain on my Car
Hi, I'm working on building a new site. http://www.pilatesboisfranc.com/ I also bought the domain .ca (the business will be in canada) .net .org and .info All the domains are redirect to the .com This site is about my wife new business, a Pilates Studio. We would like to advertise the site on our personal car, using vinyl letters to display the domain name. Is there a way tu use the (.ca) http://www.pilatesboisfranc.ca advertise on my car and track that advertising using Analytics? I know I can use a URL something like http://www.pilatesboisfranc.com/health and track the hit, but using a shorter URL is the key. Can you help? Thank you, BigBlaze
Reporting & Analytics | | BigBlaze2050 -
Is there any way to see how one my keywords ranked historically before I started tracking it?
Hello there! I'm in need of some historical data on some keywords as they relate to my site. Basically, I'd like to track which events have had the most impact on moving me through the rankings, but I wasn't using Moz at the time I had made some changes to my website... Is there any way to see how I ranked for a particular keyword at a given point in time? Thanks! Gene
Reporting & Analytics | | BGroup0