4Ps Marketing

Tracking Custom 404 Pages In Google Analytics

It’s never a good thing when visitors to your website land on a 404 page. It can have an impact on conversion data, as well as decrease the chances of visitors returning to your site. On the other hand, if a custom 404 page isn’t set up in the first place then you are at risk of damaging your brand’s potential for online traffic, not to mention the brand itself.

As strategic digital marketers, we always advocate 301 redirecting a 404 page to the most relevant content for that page. This will then transfer the power built up in the 404 page to the URL which has been identified as having the most relevant content to suit the search requirements of the user. However, the question you may want to ask yourself is “How do we ensure that we know when a page has a 404 error?” You may answer that question with “Well, we can always check Webmaster Tools.”  Agreed.  But what if the usual custom 404 page is not a crawlable URL? 404 pages can be created when someone shares a page on Twitter, for example, or via an e-mail. Google will not be able to crawl the page in these instances.

So what’s the solution?

By using event tracking, we are able to see the 404ing URL, the source and the keyword that the visitor came through to get to that page. If there is no 301 re-direct or if the keyword search volume is significant, then you may be justified in having a specific page for users coming to the website through that particular source. Still with me so far?

The next step is to put the tracking in place to serve these requirements. This will allow us to see which pages are 404ing in Google Analytics.

The code can be implemented within the <body> tag in the page source.


The element above tells the search engines 3 things:

1. var strPage = document.location.pathname; – This tells Google the naming dimensions of the page to be included within the report i.e. URL, Keyword.

2. var pageTracker = _gat.getTracker(“UA-*******-*”); – This ensures that the events are recorded within the correct Google Analytics profile

3. pageTracker._trackEvent(“Errors”,”404″,strPage,1); – These are the event parameters that need to be shown within the Events report in Google Analytics. This will ensure that the URL and page dimensions are pulled into the report.

Reporting On 404 Pages In Google Analytics

At 4Ps we generally ensure that we monitor the frequency of visits to 404 pages to ensure that the website is not punished for serving users with inappropriate content. It also allows us to see which areas of the website could benefit from additional content as well as possible keyword opportunities.

4Ps isn’t just another SEO agency. To discuss how analytics and content are evolving together in order to keep pace with new developments in user interaction and tracking technology, give us a call on +44 (0)207 607 5650 for a no-obligation coffee and chat about data, marketing and user behaviour across all inbound channels. Where could a 4Ps analytics consulting project take your brand?