10.19.2007

Google Analytics UrchinTracker Variable

I am a cheap-ass bastard. I'm not denying it. I got my coupon clutch, my Firestone Falcons discount card and a variety of discount cards from a zillion stores. So when I find a good deal, I take advantage of it.

One of the best deals in analytics right now is Google Analytics. It is totally free and is of a very high quality. It is simple to install and has some amazing standard reports.

To set up Google Analytics all you really need to do is toss some code on your page. It looks like this:
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct="UA-xxxx-x";
urchinTracker();
</script>
The script call to Google-Analytics.com contains a lovely JavaScript file of Google-y Goodness that we can't customize. The first little block of x's are your account number the x after the dash represents which profile in your account the data belongs to. Then there is a fun little variable call urchinTracker.

The urchinTracker variable is a great little tool to help you name events that happen allowing your Google Analytics account to become quite the little powerhouse. (There is one little catch. Make sure you have the Google Analytics code just after the tag of the page instead of at before the tag. The Google-y Goodness is needed in order to get some of these to work properly.)

UrchinTracker can be used in a number of ways so I thought I'd break it down for you.
  1. Change the name of the page!

    You got some nasty, über-dynamic URLs? Use urchinTracker to make it look nice in your reports! You can name it anything you'd like, but I'd recommend some sort of logical structure. This is all taken care of in the code on the individual page.

    Example: I have a nasty URL for my taco page on my foods of the world site. I wish I could find this page in my reports.

    Let's fix this! Your new page code could be:
    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct="UA-xxxx-x";
    urchinTracker('/Mexican-food/Tacos');
    </script>
  2. Flash is the coolest thing EVER!!!!

    So let's say you have a Flash site and since you can't get indexed organically, you're paying for all of your traffic and you'd like to know which terms are actually worth your money. Making you life even better, your entire site is one Flash movie. UrchinTracker can help.

    UrchinTracker and ActionScript are like long lost brothers finding each other after 15 years apart: It starts out a little bit awk-weird, but it ends up pretty good and they'll probably send each other birthday cards or go out for a snifter of brandy for special occasions.

    Example: I have a form on my Flashy site. How can I track it?

    You have to make some changes to you .fla file in order to get this to work. In the on(release) ActionScript (or whatever ActionScript command you are using) for your submit button, toss in the following code:
    getURL("javascript:urchinTracker('/flashForm/thanks');");
    Yep. It's that simple.

  3. Downloads, downloads, and more downloads.

    I don't know about you, but I would like to see information that pertains to downloads of PDFs and MP3s on my site. Unfortunately, Google Analytics doesn't like to track non-HTML files natively.

    Example: I have the biggest Rick Astley unofficial fan site in the Western Hemisphere. How do I track the illegal MP3 downloads from my site?

    Ready for this one? Okay. This time the code needs to go in the anchor tag of the link to your MP3. Here's your code.
    <a href="http://www.you-ve-been-rick-rolled.com/music/
    never-gonna-give-you-up.mp3" onClick="javascript:urchinTracker ('/mp3/NGGYU); ">
So there you go. Lots of simple ways to use urchinTracker to make your Google Analytics account more fun! Okay... maybe "fun" isn't the right word. How about more useful? Yup. I like that better.

Labels: ,

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home