Pages regularly appear and disappear on websites, other websites might link to wrong URLs on your website, etc. You can track with Piwik which URLs are leading to a 404, and which referer pages link to 404 on your website.

  • Setup a custom 404 page: you can easily do this if you use a CMS (for example, in wordpress, all 404 pages are loading a custom 404 template). If you don’t use a Content Management System, you can usually specify a 404 custom page in your webserver configuration file.
  • Add the Piwik tracking code in this custom 404 page. In the Javascript tracking code, add the following:

    _paq.push(['setDocumentTitle',  '404/URL = ' +  encodeURIComponent( + '/From = ' + encodeURIComponent(document.referrer)]);

before the line

  • In your Piwik report, in Actions > Pages Titles, you will now have a new entry for the 404 pages. It will also list the full URL of the 404 pages, as well as all referers leading to this page. Enjoy!