Solved

google analytics with hash marks (jquery tabs)

Posted on 2011-09-26
1
759 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
alert on input text 2 25
Put POST values into cookies. 14 34
Read text on Table 7 29
What is the correct way to check for empty value in input field 2 18
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

749 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