404 error page tracking

Hint

Please note that if you decide to use the 404 error page tracking feature, this will count towards your total monthly page view allotment.

Tracking 404 error page occurrences is essential for web site owners. You can track 404 pages in PrivateAnalytix, which will allow you to:

  • Get an easy overview of which pages have been triggered

  • Identify where visitors have experienced a broken page

  • Allows you to mitigate (fix) the broken page

If you want to track 404 errors on your web site, do the following:

1. Ensure that your PrivateAnalytix pixel is installed

Make sure that you have installed your PrivateAnalytix pixel code in the <head> of every page on your web site. Learn how to do it here.

It should look like so:

<script data-host="https://privateanalytix.com" data-dnt="false" src="https://privateanalytix.com/js/script.js" id="YOUR PA ID" async defer></script>

2. Add this piece of code to your 404 page header

Add the following code to the header (between <head> and </head> tags of your 404 page template.

<script>
    window.addEventListener('DOMContentLoaded', function () {
        pa.track({name: '404'})
    });
</script> 

Now, you will be able to see the number of 404 error page occurrences and the URL of the pages in your "Events" tab.

Last updated