Jul 26, 2007
Track anything with Google Analytics
Posted by: Admin on Jul 26, 2007

Google Analytics is a great way to track your visitor stats. However for those of us that want to track more specific events it seemed like we were out of luck. Have you ever wished that you can track a particular download, maybe you use a lot of flash and want to track specific events inside your flash movies, what if you wanted to track a specific ajax call. All of those things can help you understand your visitors, and the way they use your site.
You will be surprised that Google does offer such tools and they are included in that priceless package you get when you sign up. Google provides us with a Javascript function urchinTracker. This function takes a string and will use it as the title of the page in your reports. Isn't that great? Now you can track whatever event you wish.
Here are some examples of how you would use it:
Lets say you want to track a link click from a flash movie. You would use something like this:
getURL("javascript:urchinTracker('Put something here to describe the event to google.');");
If you want to track a regular link click you can add this line to your html:
onclick="urchinTracker('Put something here to describe the event to google.'); return true;"
Hope this helps you track your visitors better.
Tags:
