Not using Google Analytics? You should be!

Over the past few days I have received a number of comments regarding a recent article I published about re-directing a Page by Appending an HTTP Header, and linking this with Google's Analytics PPC tracking for Affiliate click-throughs. Read it here AppendHeader.

To cut to the chase, I thought I'd put together an article regarding Analytics and just how easy it is to implement in your code. Still not convinced? Then take a look at the screen shot below of GeekZilla's Analytics. All this information for free!! When combined with Adwords you can really understand how effective your marketing campaigns are with a clear view of your ROI.

The Geo Map Overlay is a particular favourite of mine. We even have readers in Beijing.

Getting started

Okay, so I've got you interested. You'll need to sign up to Analytics first. Occasionally you'll be placed on a waiting list, this isn't a problem and you'll get access soon.

Got an account, set up your site

This couldn't be easier. From the main page simply click Add Website profile in the Website profiles box. From here simply enter your domain name and Analytics will generate the JavaScript snippet required to implement the tracking in your site.

<script src="" type="text/javascript">
<script type="text/javascript">
    _uacct = "UA-xxxxxx-x";

This is where ASP.NET comes into its own. Hopefully you will be using a MasterPage(s) in your application and you merely have to cut and paste the Analytics Snippet into the header of the document. If you're not using ASP.Net then use an include of some description or stick it in the header of each page if you have time on your hands.

What's next?

Once you've got your tracking Snippet installed, the Analytics application can check your tracking is installed correctly and it will start to receive data (generally 24 hours behind). You can exclude certain traffic by using the filter manager so you're not tracking your own hits.

Conversion Tracking

If you're running PPC campaigns you'll have a Google's Adwords account. Simply set up the conversions you want to track in the Conversion Tracking tool and Cut and Paste the generated snippet into your key pages. You can track Purchase/Sale, Lead, Signup, Views of a key page, or anything else you're interested in.

<!-- Google Code for PURCHASE Conversion Page -->
<script language="JavaScript" type="text/javascript">
    var google_conversion_id = xxxxxxxxxx;
    var google_conversion_language = "en_GB";
    var google_conversion_format = "1";
    var google_conversion_color = "FFFFFF";
    if (purchase_value) {
          var google_conversion_value = purchase_value;
    var google_conversion_label = "PURCHASE";
<script language="JavaScript" src="">
    <img height=1 width=1 border=0     src="    value=purchase_value&label=PURCHASE&script=0">

You can even make use of the google_conversion_value variable by dynamically setting it based off the value of the sale, or if you're generating a lead and know the commission paid simply hard code it. This will give you a view of your ROI from your marketing campaigns.

I hope this has been useful, and that you choose to use Google Analytics if you haven't made that choice already.

Author Paul Marshall

A self confessed Microsoft bigot, Paul loves all Microsoft products with a particular fondness for SQL Server. Paul is currently focusing on Web 2.0 patterns and practices and is always looking for better ways of doing things.

I love the .net platform, and I find it to be the most productive toolset I have used to date.

Add Comment


Your comment has been received and will be shown once it passes moderation.