[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Track Ajax Form Google Analytics

Posted on 2011-04-29
7
Medium Priority
?
725 Views
Last Modified: 2012-05-11
Hi All,

We have a simple callback form on a masterpage of our site. (i.e. so the for appears on every page).

Now we arelooking at setting up a goal in google analytics to track which page the user navigates and then track the form submission, which uses ajax.

Now can anyone help me to do this?

First of all, is there an easy way fr me to track all pages on the site? next I assume I need to add tracking code to the success part of the jquery ajax submission, how and what do I put here please?

i.e. so we could say the user entered at the contact page -> then illed the form in.

Thanks in advance,

Matt.
0
Comment
Question by:flynny
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 23

Expert Comment

by:Tony McCreath
ID: 35492374
If your using the new async analytics then this JavaScript code would register a page view. So you can create virtual page views for places in your Ajax.

_gaq.push(['_trackPageview', '/Virtual-Page-Name']);

Or you could track things as events in Google Analytics with this sort of code:

_gaq.push(['_trackEvent', 'link', 'click', 'linkClicked']);

http://code.google.com/apis/analytics/docs/tracking/asyncUsageGuide.html
0
 
LVL 1

Assisted Solution

by:AnalyticsNinja
AnalyticsNinja earned 668 total points
ID: 35689019
Try not to use virtual page views as these inflate page views and mess up bounce rates. It is always best to use custom variables. If you do have to use virtual pageviews make sure to include /fakepath so that you can identify them.

Remember that in the new v5 of google analytics you can now do events as goals, which is very useful.
0
 
LVL 31

Expert Comment

by:gwkg
ID: 35722096
@AnalyticsNinja I tend to look at trackEvent for actions that wouldn't normally generate a page view, like controls on a video player.  

Submitting a non ajax form would normally dump a visitor to a thank-you page, so generating a page view would not be inappropriate.  

Is there an advantage to using trackEvent for form submissions that I am overlooking?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
LVL 23

Assisted Solution

by:Tony McCreath
Tony McCreath earned 664 total points
ID: 35725405
@gwkg - not that i can think of.

I'd agree that a thank-you pageview would make sense in this case.

It's easier to set-up goals with as well.
0
 

Author Comment

by:flynny
ID: 35736618
ok sorry so would I take it I wouldnt' be adding the pageview to the master page (to disinguish between the pages??)

and then would add the event in te jscript ajax success method

_gaq.push(['_trackEvent', 'link', 'click', 'linkClicked']);

?

0
 
LVL 31

Accepted Solution

by:
gwkg earned 668 total points
ID: 35740773
You would still have the analytics on the master page as normal.... you do want to track that page when it is viewed.

Look here for specific information on tracking Events

http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html
0
 
LVL 1

Expert Comment

by:AnalyticsNinja
ID: 35745433
The advantage of events over fake page views is that you can set-up a goal success rate based on an EVENT in GA v5. Also fake page views monkey with the base layer of data and muck up bounce rates.

I really wish people would not use fake pageviews and use events which are far more scalable,
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ranking ecommerce websites is a vital process. You need to have a strong SEO (Search Engine Optimization) strategy. If you don’t have one, you are losing out on brand impressions, clicks and sales. Check this guide on how to improve website traffic …
Strategic internal linking is often considered an SEO power technique, especially for content marketing. Do you need to hire an SEO agency to optimize you internal linking? No, this article will help you understand the basics of internal linking and…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses
Course of the Month8 days, 17 hours left to enroll

590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question