Friday, July 16, 2010

gaAddons v2.0 - now with async!

Update: gaAddons v2 is available at http://gaAddons.com

I'm currently alpha testing gaAddons v2.0 on my blog and my site - and you can help me simply by visiting any of my sites and click on outbound links, downloads and email links!

What is gaAddons?
It's a collection of useful enhancements to extend and improve upon the default Google Analytics implementation. It actually leverage the popular jQuery light-weight and powerful JavaScript library.

I had created a first version a while ago - still available here - but you are really better off waiting for v2!

What's in v2?

  • Use the new async calls
  • Track outbound, downloads and email links using events ("fake" pageview mode also supported)
  • Track real bounce rate by triggering an event after 30 seconds on a page (default)
  • Avoid affecting bounce rate when events are on 1st page view of a visit (default)
  • Easily customize the default options
  • Use a tagging syntax identical to Google Analytics style
There are a number of ideas and features upcoming - use Support to share feedback & ideas!

Example

You will notice the code bellow is a slightly modified version of the default GA tags:
<script type="text/javascript">
   var _gaq = _gaq || [];
   _gaq.push(
      ['_setAccount', 'UA-XXXXX-X'],
      ['_trackPageview']
      );

   var gaAddons = gaAddons || [];
   gaAddons.push(
      ['_trackOutbound'],
      ['_trackDownloads'],
      ['_trackMailto'],
      ['_trackRealBounce']
      );

   (function() {
      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  
      var gaAddons = document.createElement('script'); gaAddons.type = 'text/javascript'; gaAddons.async = true;
      gaAddons.src = 'gaAddons-2.0.min.js';
      s.parentNode.insertBefore(gaAddons, s);
   })();
</script>

That's all you'll have to do to start getting additional metrics under Content/Event Tracking.

Warning!

Wait for my signal before using this code on your own site - I'm currently alpha-testing and there are chances you might screw up your Google Analytics data - and I will not support you!

There will be a beta-test phase where you will be invited to test it on your own site.

Alpha-testing:
  1. Head to the gaAddons v2.0 page and look for the Test Cases at the bottom of the page
  2. Click on  a couple of outbound links, downloads and mailto
  3. That's all I need from you to help me out!
This will a) allow me to quickly get sample data and b) test several conditions using different browsers c) test the unknown!

Please use Support to send in any feedback, ideas, thoughts or just share a comment on the blog.
Post a Comment