8 Tips for Tracking With Google

Click tracking

If you are tracking clickthrus, events, conversions using Google Analytics here are a few tips, ideas and hints for tracking and then later on improving your webpage using Google tools : analytics, adwords and Google website optimizer.

New to Google Analytics is something called event tracking. Google events are slightly different than goals in Google analytics and while Google suggests that you track using events – I could find no easy way / interface to see which keyword is generating a desired event – like a click thru or a sale with events. This leaves  us with a  doing both tracking events and generating goals to have the best desired result.

  1. Here are some ideas for best practices for click tracking on an affiliate website.
  1. Install Jquery – this is easy to do ( 1 line of  lightweight javascript) . Why ? Because you can use jquery to track all similiarly named outgoing links. See how tiny jquery is by clicking here.
  2. Redirect / rename all affiliate link simliarly -  I am using a plugin called gocodes - it seems pretty good and I am sure their are others. But the point is that you want to track every click thru and you want all the links you are tracking to look the same.  So you want all affiliate links to look  like /recommends/ or /go/ , etc. To be consistent but also because of the tracking code provided below and because of Tip number 3
  3. Setup goals for click thrus on Google Analytics – If you are following point number two above you can easily set a goal for all links that match  /recommends/.+ ,  /go/.+ or whatever syntax you use.
    analytics goals

    analytics goals

    Even better if you can track both click thrus and goals but for right now – just do clickthru tracking -  An article to reference — http://analytics.blogspot.com/2009/05/how-to-setup-goals-in-google-analytics.html

  4. Install this tracking code to track all click that match  your syntax.
    jQuery('a').click(function(){
    var $a=jQuery(this);
    var href=$a.attr('href');
    if(href.match(/go\//))
    {var category='outgoing';
    var event='click';
    var label=href;
    pageTracker._trackPageview(href);
    pageTracker._trackEvent(category,event,label);}}
    );

    This kind of tracking code matches all outgoing links with the keyword /recommends/ and will generate a goal proivded you did the previous steps for 2 and 3. To change this syntax to another naming convention is easy enough. This code also generates both a goal and an event in analytics.
    Thanks to  these contributers listed- for this idea — rebeccamurphey , think2loud and css-tricks
    If this is too complicated then manually insert page tracking – http://www.johncow.com/google-analytics-creating-goals/

  5. To track conversions in adwords or to assign conversions to click thrus you could just click add this code snippet below
    var image = new Image(1,1);
    image.src = "http://www.googleadservices.com/pagead/conversion/XXXXXXX/?value=1&label=Purchase&script=0";

    This just initiates an image pixel so that a conversion in adwords is generated.

    So now you have tracking for goals, events and possibly adwords conversion events setup for your website done easily provided that you name , cloak and redirect your links in all the same fashion

  6. Now if you want to try and improve your webpage - you might try this - Counting a conversion when a link is clicked with website optimizer Here is the essential code
    <!-- function ConversionCount() { _uacct = 'UA-xxxxx-x'; urchinTracker("/yyyyyyyyyy/goal"); return true; } // --><a onclick="return ConversionCount();" href="http://www.example.com/file.pdf">Download the file</a>
  7. If you are looking to improve , decrease page bounce rates – then you might try optimizing pages using webiste optimizer for a version that keeps people on your website longer — Here are the details – http://www.google.com/support/websiteoptimizer/bin/answer.py?hl=en&answer=74345
  8. Stuck with how to setup a landing page ? Here is a simple optin idea for lead pages – landing page generator - very simple but you get the idea here or even better monitor adwords campaigns that are working with a tool like traffic travis.

By implementing these tips you should be able to track and improve your webpage’s effectiveness with Google tracking tools.  Leave a comment below if this helps you!

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Technorati
fields marshall Fields Marshall is a web developer and Google Adwords professional located in Pucon Chile.

If you found this article helpful, please consider linking to it it or sharing it with someone else.

Any comments ? Please leave them below.

Related Articles

20 Comments »

  1. minette roos Said,

    September 16, 2009 @ 6:35 pm

    I sure wish I had stumbled apon anything close to this article months ago.. I can’t believe how much relevant information I’ve just viewed alltogether!

    Thank You
    Brgrds

    Minette Roos

  2. fields.marshall Said,

    September 18, 2009 @ 5:03 pm

    Your welcome Minette I hope it helps .. Thanks for reading

  3. Marco Said,

    November 24, 2009 @ 10:25 am

    Hi!
    This was exactly what I was looking for – event tracking in combination with gocodes.
    Unfortunately I just can´t get it to work.
    You use the basic tracker-code twice. Once with google Analyticator for wordpress, inkluding the event-line and once without – does that the trick?
    Best regards
    M

  4. fields.marshall Said,

    November 25, 2009 @ 3:32 am

    Macro,

    You are right on this website I am using it twice I need to fix that. On other websites I use it just once which does the trick.

    I have it working on another which website are you trying to track ?

  5. fields.marshall Said,

    November 25, 2009 @ 5:43 am

    Marco .. I know whats wrong with your setup .. Look at my revised code

    http://docs.jquery.com/Core/jQuery.noConflict <-problem here

  6. Marco Said,

    November 25, 2009 @ 10:33 am

    Well, hello again!
    Thanks for your reply!!
    I copied the code and put my syntax in. (hopefully in the right way, I guess I´ll have to check the /\ combination in /?anbieter=\// again).
    After it ran for a night I´ll see if it works that way.
    I will let you know!
    Take care,
    regards from germany
    Marco

  7. fields.marshall Said,

    November 25, 2009 @ 8:18 pm

    Marco yes I changed the slashes so that it matches go/ but more importantly these two lines were changed

    jQuery(‘a’).click(function(){
    var $a=jQuery(this);

    to use jQuery instead of $ because wordpress uses jquery but with JQuery.noConflict – very technical but using the new syntax this should work ..

    I suggest setting up a click thrus as a goal also are you doing that too ?

    Good Luck with your site
    http://docs.jquery.com/Core/jQuery.noConflict

  8. Marco Said,

    November 26, 2009 @ 11:25 am

    That ist technical ;-) – and I´m just not a programmer.
    So, I at first did not change the jquery.js – now I did.
    And yes: I set up the click thrus as goals.
    I´ll tell you tomorrow if it now worked!
    thanks&take care!

  9. fields.marshall Said,

    November 26, 2009 @ 11:40 am

    marco I looked at your site

    You should change this line
    if(href.match(/?anbieter=\//)){
    to
    if(href.match(/?anbieter=/)){

    I dont think its going to work as you have it now..

    You are not using Gocodes it appears do you have another tracking program ?

    Also put a javascript alert to test if tracking is working right away

    so do
    if(href.match(/?anbieter=/)){ alert(“working”); and then remove the alert(“working”) once you have confirmed it is working

  10. fields.marshall Said,

    November 26, 2009 @ 11:42 am

    you might have to play around with that line — Im sure that
    if(href.match(/anbieter/)) will work to create an event

    You goal in analytics is setup to match anbieter correct ?

  11. Marco Said,

    November 27, 2009 @ 1:07 pm

    Hi!
    It indeed did not work. Unfortunately once I put the line into the analyticator google analytics doesn´t track anything anymore.

    I do use gocodes, but it is a modified version of that plugin. The bad part about that is, that I cant change the “?anbieter=” in “/anbieter/”. Do you think the parameters ? and = could cause Problems?

    This alert idea is a good one, I´ll experiment with that and your suggestion of syntax.
    thanx and take care!

  12. Marco Said,

    November 27, 2009 @ 2:04 pm

    Hm, hm… I don´t get it. The alert at least doesnt work.
    And I forgot to say: Yes, I have a goal set up – and tried it in those different combinations like
    /\?anbieter=.+
    /anbieter/.+
    /?anbieter=.+

    the latter I try to use with “;if(href.match(/?anbieter=)” (since that is the typical part of the gocodes Links. (like for example: http:// www. partneragentur-vergleich.de/?anbieter=PartnerSite)

    I somehow run out of ideas…

  13. fields.marshall Said,

    November 27, 2009 @ 3:09 pm

    hi Macro

    are you familiar with regular expression matching ?

    that is what is going on there in the href.match() statement

    change this line
    href.match(/?anbieter=)

    to href.match(/anbieter/) and you should see the alert .. you are almost there

    Let me know if that works and if not contact me via the contact form and I could login to your wordpress system and adjust it but I think all you need to do lookin at you r page is to
    change this line
    href.match(/?anbieter=)

    to href.match(/anbieter/)

  14. Marco Said,

    November 27, 2009 @ 5:33 pm

    Hello Fields,
    (by the way – I didn´t quite figure out your first name was Fields in that combination. I guess you probably here that sometimes?!)

    I tried to bite my way through the regular expression matching, but maybe I got the two slashes wrong. I now changed to (href.match(/anbieter/) and the regular expression matching to /anbieter/.+
    hopefully that´ll do it.

    Have a good weekend!

  15. Marco Said,

    November 27, 2009 @ 5:39 pm

    I just tried for the alert using Internet Explorer (normally FireFox) there it shows that the error occurs in the line 456 “pageTracker._trackPageview();”

    > so i guess it might be still rather the code than the regular expression matching, what do you think?

  16. fields.marshall Said,

    November 28, 2009 @ 5:36 pm

    Hi marco,

    I am not seeing this work on your page I think because anything after the ? is technically a querystring and so a href.match only matches the hyperlink

    http://forums.asp.net/p/1447719/3297106.aspx

    There does not seem to be a way to match the query string easily that I know of but I know very little of jquery

    too bad you cant do the standard way that gocodes normally work .. it appear you will half to embed javascript on each affilate redirect link onClick= pageTracker._trackPageview(); something like that

    sorry I do not have easy answer for you

  17. Marco Said,

    November 30, 2009 @ 8:41 am

    Good Morning Fields,
    maybe I will have to start using the “normal” GoCodes. I will take a closer look at it – and if I find a way I let you know!
    Have a good week – and thanks again!!
    Take care -
    Marco

  18. fields.marshall Said,

    November 30, 2009 @ 1:11 pm

    Hi Marco,

    check this plugin out also … It looks better than gocodes

    http://blairwilliams.com/pretty-link/ I already have my system setup so I probably wont switch but it looks pretty cool

    good luck

  19. Split Testing Software Said,

    December 15, 2009 @ 8:40 pm

    [...] and set a goal in Google Analytics for all simliarly named link as I have explained here — http://fieldsmarshall.com/8-tips-for-tracking-with-google/ – and then either use the gocodes plugin or the pretty link plugin for wordpress – to [...]

  20. fields.marshall Said,

    January 10, 2010 @ 3:09 am

    For the new asynch link code — check out this post ..

    http://www.expertsem.com/2009/12/09/creating-virtual-pageviews-with-google-analytics-asynchronous-tracking/

RSS feed for comments on this post · TrackBack URI

Leave a Comment