How to track error pages (404 pages)

Hi, i´m sorry i have posted here somewhere else but false Information

in piwik FAQ part (How to track error pages (404 pages) in Piwik? Which URLs are 404 and which referers lead to these pages? - Analytics Platform - Matomo) there is a article about tracking 404 pages.

I have added the tracking code:

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

as mensioned in my piwik code bevor the line:


The result is that also every valid URL is listed in the report: Actions > Pages Titles in the entry for 404 pages, i hope i explain it clear (english is not my language) an example a page or post who is ok is after putting the code also listed by 404 pages

do i have to edit something in the code?

hope somebody can help


I guess you have this additional line now on every single site.
But you are supposed to put it only in the file, you actually load(eg. via .htaccess) when a 404 error occors on the server.