16 Jan errr-ROAR pages
So I want a tidy way to track error pages in google. Seems like that would happen by default right?
So how about a nice way to see the host, full referring path, and the attempted destination? Then you can make a report and send it over for someone in content editing to deal with it.
Here is what I did.
1. Create a Google Tag Manager account. See here for questions.
2. Create your Google Analytics account for your error pages only.
3. Create a container in GTM. Then use the ‘Custom HTML Tag’ option and insert the following…
var _gaq = _gaq || ;
_gaq.push(['_trackPageview', document.location.href + 'LinkLocation=' + document.referrer]);
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’); s.parentNode.insertBefore(ga, s);
4. Obviously you need to replace the XXXXXX-X with your own GA code.
5. Don’t forget to fire this on all your pages and add the container to any other error pages.
So what do you get in the end?
6. Head over to your Content Overview page. Content – Site Content – Pages and look at those URLS. Very interesting huh. How add the secondary dimension of host to see where that’s coming from if you are using this error page on multiple different domains.
Your Content Page URLs will look like this…
It will be your job to disect the URL and take care of fixing the errors. Here is the breakdown.
- Ignore the first part… https://www.yourdomain.com/index.cfm?PID=404
- Here is destination url which was bad: &ErrorPage=great-software/
- Here is the location where you’ll find that bad link: LinkLocation=http://yourdomain.com/types-of-software
You may want to go ahead and create a handy custom report so that you can always just click on it.
It makes me very happy to see a peaceful error report. After you take care of those bad links, it’ll be great. Imagine having this setup once you start a site migration. You might tear your hair out, but atleast you KNOW it’s happening!