James Royal-Lawson


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.

Why changing Twitter name is a 404 nightmare

In February this year Swedish Social media facilitator Anders Sporring decided for personal branding reasons to change his Twitter profile name from @CityRat59 to @AndersSporring

I’m going to side-step the debate of whether this is a good or bad thing to do from a branding perspective, but instead use it as an example of what impact it has on your web presence.

404 nightmare

Anders was sensible enough to create another twitter account which he used to grab his original name of CityRat59 as soon as he changed the name to AndersSporring – but, this process creates an awful lot of 404s. In fact, it creates a “page not found” for all the URLs to every single tweet you’ve tweeted until the moment you changed name. In Anders’s case, this was thousands.

Twitter basically switches your usename in the URL, with makes no attempt to redirect any of the old URLs with a 301.

Twitter status

Twitter phishing!

All old replies still contain the original profile name, and the original profile name is still linked. So if Anders hadn’t grabbed his old account name and let someone else grab it, suddenly all his old statuses would be linking to someone else – Twitter phishing! Your original name would be hijacked, including any link-juice that the old profile may have had.

The replies are relinked to the new profile; which maintains the thread from a twitter perspective, albeit a little confusing due to the mix of old profile name and new.

Broken lists and favourites

It’s not only old tweets that give “page not found”. All your lists and favourites will also change URL with no redirect. Take Anders’s “Social media club Sweden” list. It’s original URL is still indexed by Google (at the tme of writing), but of course gives a 404. Google hasn’t been told that the list has a new URL.

Like changing domain

The conclusion? Changing twitter name is very similar to changing domain name; but without any control over redirects. If you have an established Twitter account with a long history of tweets (and perhaps a large number of followers) then you will end up with thousands of broken links and related content that has been indexed by search engines and various twitter-related sites.

My advice would be to think carefully about what Twitter name to adopt when you first join, and then think even more carefully before changing it at any point – Changing Twitter name has a wider reaching impact than you may have initially realised.

Update 20140924

It would appear that Twitter have sorted out most of the redirect problems that used to exist when changing Twitter name. Niklas Wikman changed Twitter name recently and wrote up his experience (in Swedish). Conversions are maintained (the threading changes name, but the username contained within the actual tweet remains the same) and Twitter is creating redirects for all of your old tweets. Changing Twitter name doesn’t seem to be at all the nightmare it once was.

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]);
    _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)

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 ( != -1) {
    keywords = gup("p"); 
  else if ( != -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 "";
    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 11, 2010)

Matt Cutts Interviewed by Eric Enge

Matt and the Google Webmaster Central blog are excellent sources of information regarding how Google works and what you should be doing. This is a long and interesting interview and gives some useful answers to a number of questions. For those of you who don’t the patience to read the full interview there’s an illustrated summary available.

Best Practices for Your Google Local Business Centre Listing

Claiming and looking after your Google Local Business Centre (Googles lokala företagscenter) listing is an important part of maintaining your web presence. This post gives some good suggestions as to what you should be doing.

SEO breadcrumbs for site hierarchies in Google

A while ago Google started displaying breadcrumbs on some snippets in their search results. It’s an area that’s crying out for some web standards. This excellent and detailed research by Simon is the closest thing to a standard for breadbrumbs and Google that I’ve seen.

Facebook Sverige 2010 – 1,2 miljoner nya medlemmar på 10 månader

Swedish blog post by Simon Sundén which gives some interesting statistics about Facebook use here in Sweden. One area highlighted by Simon is the relative growth in the 35+ age group.

6 of 9
Reload this page with responsive web design DISABLED