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
-
What Analytics Do You Use To Track IOS and Android?
We have about 600k downloads of our app and would like to know what cost effective analytics tool you use to gain insight into what your app users are doing? Thanks! Best... Mike
Reporting & Analytics | | 945011 -
Tracking a Redirect
Recently a client of mine had a new site developed and had changed their domain, so the old URL is now redirecting to the new URL. They want to be able to track referral traffic in the analytics so we can decipher how much direct traffic is coming in from people typing in the old URL. Is this possible and if so, can I have a guide in doing so? Thanks!
Reporting & Analytics | | DigMS0 -
Tracked Event for Button Now I would I like to know that Customer reached to thank you page?
Hello Expert, For my ecommerce site I am tracking "Retrieve My Basket" button as event tracking. Now I want to know after retrieving basket did my customer reached to thank you page? So how should I track such goal? Thanks!
Reporting & Analytics | | dsouzac0 -
Track subdomains in the same analytics property/view
Hello to everyone, this is my first question (kind of a newbie here :-D). I have a website that spans over 4 subdomains + the main domain and I'd like to have a place where I can see the total page views, events and goal completions. Main domain is langhe.net, and subdomains are eventi.langhe.net, servizi.langhe.net, shop.langhe.net, about.langhe.net. The website is based on wordpress and I'm using google analytics for wordpress by yoast as analytics plugin. The configuration of the plugin is as follows: all the website have the same UA-XXXXXXXX code The Subdomain Traking field (setDomainName) is filled with .langhe.net Cross-Domain tracking is enabled Cross-Domain Primary Domain (setDomainName) is langhe.net Cross-Domain Tracking, Other Domains field is filled with: about.langhe.net, eventi.langhe.net, servizi.langhe.net, shop.langhe.net. In the GA property I've created an Advanced Custom Filter configured this way: Field A -> Extract A = hostname (.*) Field B -> Extract B = request URI (.*) Output To -> Constructor = request URI $A1$B1 Field A Required: yes Field B Required: No Override Output Field: yes Case Sensitive: no I was wondering it this is the best way of doing it, or if there are other "best practice" ways to obtain what I'm looking for (for example with this configuration it's become quite difficult to separate the traffic sources for each website). Thank you in advance 🙂
Reporting & Analytics | | Enrico_Cassinelli
Cheers!0 -
Domain Sub folder tracking from Google webmaster tool
I have created separate google webmaster access for this sub folder http://lineonebus.com/content/ Original domain http://lineonebus.com/ Search results in webmaster shows no search queries though this subfolder created in wordpress is ranking for some keywords.
Reporting & Analytics | | csfarnsworth1 -
Ga event tracking and GAC code placement
Just relaunched website and since then specific event tracking has zeroed. I copied event tracking directly from old site so it should work. Overall analytics are fine. Only variable I can think of is where google analytics code is placed. Does GAC code need to be on HTML header or at end of body specifically for event tracking to work? Example: Steripen.com/freedom/... When user clicks "REI" icon, this tracks an event that a user clicked on one of our"retailer links." Any feedback is greatly appreciated.
Reporting & Analytics | | Timmmmy0 -
Do links with tracking codes pass PageRank?
I have a client that has acquired a link from an influential partner but the partner has set the link up to have clicks tracked within their analytics. Do links like this pass PageRank: Anchor Text
Reporting & Analytics | | SearchEngineRescue0 -
Campaign tracking and duplicate content
Hi all, When you set up campaign tracking in Google Analytics you get something like this "?variable=value parameters" in the URL. If you place such a link on your site as an internal link, will it be considered as a different URL and will have its own link value? The question I have is, since Google knows it's a Google link and knows the original URL (by stripping the tags), does it pass link value to the original URL? If not, what can be done to pass link value? Thanks in advance. Henry
Reporting & Analytics | | hnydnn0