How to Track the 404 Errors on your Website with Google Analytics If you change the URL of an existing page on your website
If we change the URL of our Website or if we delete the website completely we will find the 404 or "File Not Found" error if any one want to access the page.The other reason why we have end up having 404 pages on our website is not in our control. Let us take an example if your page URL is abc.com/xyz and another site links to that page but with a wrong URL, visitors will get a 404 when they click on that link.
It is very important to fix the 404 errors because they offer a bad visitors experience and the site will lose the Google juice.Google will give the points for every incoming link but if once the benefit is lost and if the link is pointing to non-existent 404 page.
How to Track the Missing 404 Pages on Your Site
If we are using Google Analytics,you can use the same service to keep a track of all the 404 missing pages easily on your website. Let us see how it happens:
Take your standard Analytics tracking code which is already on your web pages, and add a few extra lines inside the script tag so that it will enable the tracking for 404 errors. The modified code will generate a virtual page view in your Analytics reports as shown in the above image that will not only provide you with the URL of the missing page on your website but also it will provide the URL of the referring site.
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
/* Standard Analytics Code */
ga('create', 'UA-XXXXX-YY', 'domain.com');
ga('send', 'pageview');
/* Track 404 Errors */
var url = "/404/?url=" + window.location.pathname + window.location.search + "&from=" + document.referrer;
ga('send', 'pageview', url);
</script>
This code should be added to the 404 template but not for every page
To get all the 404 pages on your site, once go to the Google Analytics dashboard and choose Behavior -> Site Content -> All Pages. Here select any date range and put /404 in the search box and you will know what is missing from your site.
since Google Analytics now offering the near real time tracking, you will know about the 404 pages on your website as they happen.
Finding 404 Pages in Webmaster Tools
We can use Google Webmaster tools if we don't have the Google Analytics/ we don't have to option to modify the code in your web pages by using Webmaster tools we can find the 404 pages on your website. Once you have added and verified your site with the Google Webmaster panel, then go to the Dashboard –> Diagnostics –> Crawl Errors and then select the option “Not found”.
Here you will see a list of all pages that returns 404 status code to Google while it was trying to index your site. The tool may not catch every single missing page of your site but, as Matt Cutts remarked, “the vast majority of the back links you would be care about that.
If we change the URL of our Website or if we delete the website completely we will find the 404 or "File Not Found" error if any one want to access the page.The other reason why we have end up having 404 pages on our website is not in our control. Let us take an example if your page URL is abc.com/xyz and another site links to that page but with a wrong URL, visitors will get a 404 when they click on that link.
It is very important to fix the 404 errors because they offer a bad visitors experience and the site will lose the Google juice.Google will give the points for every incoming link but if once the benefit is lost and if the link is pointing to non-existent 404 page.
How to Track the Missing 404 Pages on Your Site
If we are using Google Analytics,you can use the same service to keep a track of all the 404 missing pages easily on your website. Let us see how it happens:
Take your standard Analytics tracking code which is already on your web pages, and add a few extra lines inside the script tag so that it will enable the tracking for 404 errors. The modified code will generate a virtual page view in your Analytics reports as shown in the above image that will not only provide you with the URL of the missing page on your website but also it will provide the URL of the referring site.
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
/* Standard Analytics Code */
ga('create', 'UA-XXXXX-YY', 'domain.com');
ga('send', 'pageview');
/* Track 404 Errors */
var url = "/404/?url=" + window.location.pathname + window.location.search + "&from=" + document.referrer;
ga('send', 'pageview', url);
</script>
This code should be added to the 404 template but not for every page
To get all the 404 pages on your site, once go to the Google Analytics dashboard and choose Behavior -> Site Content -> All Pages. Here select any date range and put /404 in the search box and you will know what is missing from your site.
since Google Analytics now offering the near real time tracking, you will know about the 404 pages on your website as they happen.
Finding 404 Pages in Webmaster Tools
We can use Google Webmaster tools if we don't have the Google Analytics/ we don't have to option to modify the code in your web pages by using Webmaster tools we can find the 404 pages on your website. Once you have added and verified your site with the Google Webmaster panel, then go to the Dashboard –> Diagnostics –> Crawl Errors and then select the option “Not found”.
Here you will see a list of all pages that returns 404 status code to Google while it was trying to index your site. The tool may not catch every single missing page of your site but, as Matt Cutts remarked, “the vast majority of the back links you would be care about that.
Post a Comment