Beantin

James Royal-Lawson

Analytics

5 Articles worth reading… (Spotted: Week 16, 2010)

Video pollution on the web

In depth paper on First Monday covering the problem of video spam (such as where users upload duplicate content, or incorrectly tag films in order to appear in popular searches) and also some possible solutions.

The decline of the homepage

More and more often visitors are landing on pages deep in your website. The start page is losing its importance as a navigational starting point. That starting point has moved to the search engines.

Why do Google Webmaster Tools and Google Analytics Stats Differ?

The analytcs and SEO communities have been bubbling with comments, complaints and questions as to why the visit data in Google Analytics doesn’t match the newly available data in Google Webmaster Tools, Nikki has a go at explaining it.

Intranet support for emergency planning – the air flight ban in Europe

The recent situation in Europe gives an ideal opportunity to look at and assess the effectiveness of your Intranet in connection with crisis and emergency management.

Introducing Google Places

Local Business Center has been renamed and has received an update. Google are introducing interior photos (that they offer to take for free), QR codes, service areas.

6 Articles worth reading… (Spotted: Week 14, 2010)

Eye Tracking and Web Usability: A Good Fit?

A detailed and soba look into the neurology behind eye tracking studies and specifically it’s application to web usability testing. If you’re in Sweden/Stockholm then you can get a hands on experience of eye tracking at one of these upcoming free eye tracking workshops.

Understanding the Mechanics of SEO as both Art and Science

Some good SEO tips, including: “You are not in competition with a search engine – you are in
competition with your competitors.”

Evaluate Editorial Impact Using Google Analytics

Practical advice about how to evaluate Editorial Impact of web or intranet content using Google Analytics. Measure more people! measure! Fredrik Wackå has written a (Swedish) blog post in response to Lars Johansson’s article I posted the link to here yesterday. Some good practical points.

Micro-blogging behind firewalls – our work on Yammer

A collection of (research) papers about corporate microblogging, including ‘following, ‘acceptance’, and ‘incentives’ produced during a year of studying by Jun Zhang.

How Consumer Attitudes and Behaviors are Shaped in Social Media: 10 Essential Rules You’ve Never Heard – But Need to Know

A refreshingly different “do this in social media to succeed” article by Taddy Hall. Itching to know more about the empirical data he mentions and that backs up some of his advice.

Adding image information to a Sitemap

Earlier this week Google announced the addition of image data to sitemap entries, including
title and caption. This is going to be another piece of your SEO jigsaw in times of blended search…

How to track per visit referrer with Google Analytics

Prevously I wrote about how traffic sources in Google Analytics perhaps aren’t what you think, mainly due to GA’s attribution of page views, visits & visitors to the latest source. It’s not possible using out-of-the-box Google Analytics for you to see the full referring page for each individual visit.

Use Custom Variables

It is possible to use a custom filter to see the full referrer, but it’s also possible to collect the URL of the referring site by making use of custom variables and a bit of javascript. With the same technique you can also store the search phrase for those visits that came via a search engine result page.

Google analytics search phrases

The technique described below isn’t 100% accurate, (some situations cause the referring URL not to be passed on; such as opening links in new windows in Chrome) but then many aspects of Google Analytics aren’t 100% so I don’t think I’m leading you astray.

Step one: add _setCustomVar lines to your tracking code

Will Critchlow’s post describing how to implement first touch tracking article inspired me into using custom variables to record the referrer URL of each visit as well as any associated keywords.

I re-wrote the _setCustomVar lines in his code to use the new asynchronous format. What this following piece of code does is to send the referring URL and keywords to Google if a referrer exists. If no referrer is present it sends “Direct”, so we can track all direct visits too. the “2” at the end of each setCustomVar tells Google Analytics that it’s a visit level variable.

It also filters out your own domain, so that your data doesn’t get polluted by people following internal links from one page to another.

This “if” statement need to be placed in your code after the _setAccount and before the _trackPageview.

var refurl = document.referrer;

  if (refurl != '')
  {
   if ((refurl.indexOf("://"+document.domain))<0)
   {
     _gaq.push(['_setCustomVar', 1, 'Ref', 
        truncate(refurl.substr(7,refurl.length)), 2]);
     _gaq.push(['_setCustomVar', 2, 'Qry', 
        getkeywords(), 2]);
    }
  }
    else
  {
    _gaq.push(['_setCustomVar',1,'Ref','Direct', 2]);
    _gaq.push(['_setCustomVar',2,'Qry','', 2]);
  }

Step 2: Truncate just in case

As Will mentions in his article, Google Analytics limits the length of the data you can send
(including the variable name) to 64 characters – or rather, it ignores anything bigger. So I borrowed his truncate function. I’ve altered it so that we can use three-character variable names (I thought that single character variable names was a little too cryptic for my use)

function truncate(input) {
  var byteLength = 61;
  return decodeURIComponent(encodeURIComponent(input)
.substr(0,byteLength));
}

Step 3: Setting the query parameter

As there isn’t a standard parameter for the search query across all search engines, I needed to make a function that could deal with the major ones that used something other than “&q=”. I saved a bit of time by looking at a php function for displaying the referring page. It’s obviously no problem to add more conditions to catch other search engines if your site receives traffic from one that isn’t captured correctly.

function getkeywords() {
  var x = document.referrer;
  var keywords = 0;
  if (x.search(/yahoo/) != -1) {
    keywords = gup("p"); 
  }
  else if (x.search(/digg/) != -1) {
    keywords = gup("s"); 
  }
  else {
    keywords = gup("q"); 
  }
  keywords = truncate(keywords.replace(/+/g, " "));
  return keywords; 
}

Step 4: Extracting the keywords

In Will’s original First Touch post, he saved the query string unaltered with no tidying up or further parsing. I adapted the code from this article that parses the URL of the current page so that it parses the contents of document.referrer. At the time of writing, Google Analytics has a bug in it which means custom variables get spaces displayed as %20 in reports.

This is the routine that the getkeywords function above calls once we’ve worked out the query parameter.

function gup(name) {
  name = name.replace(/[[]/,"\[").replace(/[]]/,"\]");
  var regexS = "[\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( document.referrer );
  if( results == null )
    return "";
  else
    return results[1];
}

Sit back and wait

After a few hours you’ll be able to find some results via custom reports (and perhaps “Visitors -> User defined”) but it can take a few days before results show up under the Custom Variables report.

Once they do start to appear, you should see something similar to that in the picture below.

Google Analytics custom variables

Now you are collecting referrer information on a per visit basis, including if the visit is direct – as well as all the associated search queries. It should also be relatively straight forward extend this technique to track other per visit information too, but we’ll save that for another day…

Updated: 2011-01-17

I’ve updated the code above to take into account situations when the refering URL is your own domain.

For your reading pleasure… (week 10, 2010)

Social Media Cheat Sheet

A useful refererence to have in your collection. It’s comprehensive enough, up to date, and contains relevant advice.

Reporting from the Internet and using social media

Reuters have published their social media guidelines. Built on Reuters own “Trust Principles”, they are a good, sensible, example of how to guide employee’s SM activity.

Thoughts on SEO Future and how to rank on a realtime web

Jesper’s almost weekly appearance in my recommended reading post. Speculation rather than fact; but optimising for the real-time web is obviously of rapidly increasing importance. Your reputation, relevance, geo-location & social peers are all going to be factors.

10 Steps for Optimizing the Brand for Social Search

Looking at the human side of things rather than the SEO side of things, Brian says that the key to Social web & social search “is to incite participation and sharing”

The Future is the Mobile Web (not the Mobile App)

I’ve mentioned previously how use of platform specific applications to deliver content that would normally be viewed on a website is not optimal long term. This post from PercentMobile highlights the problems of the walled garden and applications that are more suited to being mobile websites.

25 useful Google Analytics tips and tricks

A genuinely useful list of tips, tricks and hacks to get that little bit more out of Google Analytics.

Explained: Sources in Google analytics

Looking at various related blog posts, I’ve realised many people don’t fully understand or fully explain how traffic sources are attributed in Google Analytics.

A Cooked named ___utmz

Let’s get straight to the details about sources…

  • Uses a cookie called ___utmz
  • Only gets updated each time the source is different to the source stored in the cookie (excluding direct visits)
  • The utmz cookie lives for 60 days since it was last updated

If you want a full run down then Analytics Market give an excellent and detailed explanation of all the Google Analytics cookies on their blog.

Detail of a screenshot from Google Analytics

All this means that if a visitor reaches your site (irrespective of landing page) via Google, then that visitor (note visitor not visit or page view) will have Google attributed as the source for every page they look at across every visit they make to your site. This will be the case until 60 days have past or the very same visitor comes in from another source (such as a link in a newsletter, or by clicking on a banner, or on an adwords ad)

Understanding Google Analytics reports

Make sense so far? The next part is to understand how this affects the way you read various reports in Google Analytics. Take the Top content report for example. Say your top page has had 5000 page views during the past month. Segment those by Source and perhaps 3000 of them are attributed to Google.

The easy conclusion to make is that those 3000 page views are directly attributable to Google; that an organic search in Google for a particular phrase led to the visitor clicking on a particular search result and visited that page on your site. In old-school log-file-based analytics, then yes, that would be the case (substituting Source for referrer).

Detail of a screenshot from Google Analytics

In Google Analytics the real explanation is that 3000 of the page views were displayed to visitors who had, at some point during the previous 60 days, arrived at your site after searching for something in Google and, if they made any repeat visits, then all of those repeat visits were direct.

Over-estimating the importance of Google

What this means is that unless your traffic consists of one-time-visitors and nothing else there’s a good chance you’re been over-estimating the importance of Google searches in generating page views. Unless you alter the default setting of the campaign cookie from 60 days to 0, then (apart from new visitors visiting once in the view time period) you can’t correlate page views/visits with their actual sources.

Understanding per-visit behaviour

Whilst I understand the usefulness of attributing sources for all subsequent direct visits for conversation analysis and goal tracking (it’s useful to know which initial source ultimately led to the conversation) it’s of much less use in understanding the per visit (and thereby more complete) behaviour of your visitors.

5 of 6
123456
Reload this page with responsive web design DISABLED