Solved

google analytics with hash marks (jquery tabs)

Posted on 2011-09-26
1
748 Views
Last Modified: 2012-05-12
I use jquery tabs on my homepage.  when you arrive at the homepage, it's like:

http://www.home.com

then if you click about us, it's like:

http:www.home.com/#about

jquery uses hash marks to keep track of the tabs. I would like to use google analytics to record data on which tabs are getting clicked and/or linked to.

I've found some sort-of-answers on stackOverflow, but to be honest, they just aren't dumbed down enough for me. It seems like I need to use a simple string replace to send GA a / instead of a # and then the tab can be tracked. But I don't know if that works for links or just tab-changes. Also, I don't know how to integrate it into the code at the bottom of the page. And I definitely don't understand how to add the connections to the Google Analytics page: are they separate profiles or accounts? do i add them using slashes or hashes.

Thank you for any help you can offer! I know there are a lot of questions here!
0
Comment
Question by:hibbsusan
1 Comment
 
LVL 6

Accepted Solution

by:
mattjp88 earned 500 total points
ID: 36715728
so GA tracks pageviews, and since using the hash isn't reloading the page, GA isn't tracking it.  Check out http://www.google.com/support/analytics/bin/answer.py?answer=55485 .  Basically you'll want to call this when you change tabs, changing /about to the correct name

 _gaq.push(['_trackPageview', "/about"]); 

Open in new window


GA doesn't track the hash value, so you'll need to make up fake "pages" for GA so it thinks those are real pages.  For example, example.com/#about is the same as example.com/ in the eyes of GA, so you'll need to tell google that the page is actually example.com/about (notice the slash instead of hash).

As for how you'll call that GA function, you'll need to read up on whatever jquery plugin you're using for a callback when a tab is clicked.

-Matt
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…
This Micro Tutorial demonstrates in Google how to submit a page to get it crawled quickly or recrawled after making changes that you wan tot show up in Google.

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now