Solved

google analytics with hash marks (jquery tabs)

Posted on 2011-09-26
1
766 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This Micro Tutorial demonstrates how to quickly find related content for YourTango's posts using MozBar Chrome extension.

696 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