Monday, June 1, 2009

My take on 404 Error Page Naming and Analytics

‘404 Error Pages’ are the pages displayed when someone is not able to find a link/URL on a website. There are usually 2 ways by which one can find the 404 page:

1) Typing in the wrong URL: If a visitor has typed a wrong URL, by default he will see a ‘The Page cannot be found’ page in case there is no custom 404 page present in the website. Below is a screenshot of such a page.

In order to fix this, the best practice is to create a custom 404 page which will be shown to visitors who try to access a page which has either been removed or doesn’t exist. This 404 page should contain links to the most important pages of your website and will play an important role in engaging visitors back to your website. You can also create 404 pages which have a funny message. Some examples of such pages can be found here.


2) Deleted or moved links: The same default page mentioned above will appear in case a visitor clicks on a link/page that has either been deleted or moved to a new location.

To fix this, implement 301 redirects which send visitors to the new page which has been moved to a new location.

As far as Web Analytics tracking is concerned, it is pivotal to accurately track how many people are looking at the 404 page and what URLs are they looking for. The method explained below will help you track 404 pages efficiently (Tracking impressions on the 404 page and the incorrect URL) through Omniture and Google Analytics.

1) Adobe Analytics: Capture the incorrect URL (JavaScript function document.location) in the s.pagename variable and append ‘404’ to it as shown below.
s.pageName="404:"+document.location (E.g. If the incorrect URL is http://www.undp.org/ss, then the pagename variable will capture it as ‘404:http://www.undp.org/ss’. This naming structure helps in gauging the amount of traffic going to incorrect pages as well as fixing broken links. Similarly pathing can be performed on the error page to find the flow of traffic to and from this page.
• Another mandatory variable which should be populated on error pages is s.pageType which should be populated as s.pageType="errorPage".
Below is a screenshot of the UNDP 404 page using similar Omniture snippet.



2) Google Analytics: Capture the incorrect URL in the trackPageview function as shown below:
pageTracker._trackPageview("404:" + document.location) (E.g. If the incorrect URL is http://seattleindian.com/seattle/xyz.asp, then the value captured in the ‘utmp’ variable will be ‘404:http://seattleindian.com/seattle/xyz.asp’.
Below is a screenshot of the SeattleIndian 404 page using similar Google Analytics snippet.


Below are some advantages of implementing custom 404 pages in your website:

1) Engaging visitors to pivotal pages of your website: If your 404 error page has links to important pages of your website, users can be sent to important pages of your website thereby increasing user engagement. You should also add a link to the sitemap page and a search box.
2) Leveraging Web Analytics to optimize your website: You can utilize Web Analytics tools by analyzing 404 URLs which users type and fix broken links on your website.
3) Reduces user frustration: Creating a custom 404 page eases user frustration caused due to not being able to find what they were looking for.

3 comments:

VaBeachKevin said...

Great recommendation, but I have another point to consider. You may want to also grab document.referrer to see what pages are leading to the error page.

Rohan Kapoor said...

Appreciate your comment and suggestion. However Omniture and Google Analytics will capture the pathing flow to and from the error pages. Thanks!

Joel said...

Thanks. That is a great tip for using GA to track what people were originally looking for. Very elegant!