?
Solved

google analytics with hash marks (jquery tabs)

Posted on 2011-09-26
1
Medium Priority
?
773 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 2000 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
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 will demonstrate how marketers can use the Mobile Emulation Tool in Chrome Developer Tool. This will let you preview your site on any mobile device.
Suggested Courses

762 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