• Breaking News

    How To Track 404 Events Using Google Analytics


    When your website visitors land on your 404 Page Not Found page, it can be everything from a major inconvenience to a pleasant surprise.

    Personally, I like to think 404 pages in terms of:

    People who only wanted to engage with your website in some way and now can’t. 

    It's up to you what to do when a given visitor faces this situation. You can either:

    • Show no interest, and just display a naked vague 404 HTML page.
    • Or you can treat this page as a landing page and encourage the visitor to keep surfing your site.


    You should care about 404 events because, at the end of the day, this event means that something is wrong with your website and has to be fixed.



    Tracking 404 Events Using Google Analytics

    With Google Analytics, tracking explicit 404 errors is simple. Just ensure that your main Google Analytics tracking script is in place and then add your current GA snippet plus the following code to your 404 Error Page/Template:

    ga('send', {
       hitType: 'event',
       eventCategory: '404 Response',
       eventAction: window.location.href,
       eventLabel: document.referrer
    });
    After that, the script works by sending an “event” to Google Analytics.

    The category is “404 Response,” the action uses JavaScript to pass the URL that throws the error, and the label uses JavaScript to pass along the previous URL the user was on.

    Through all of this data, you can then see what URLs cause 404 events and where people are accessing those URLs.

    404 Event Reporting


    Under “Behavior” you will see an item called “Events”. Here you will see all reported 404 events.

    The “Event Action” and “Event Label” dimensions will give you the pertinent data of what URLs are throwing 404 errors and their referring source.

    With this in place, you can now regularly monitor your 404 errors and take the necessary steps to minimize their occurrence. In doing so, you optimize your referral sources and provide the best user experience, keeping conversions and engagement on the right path.

    What To Do With Your Google Analytics Results


    The data should help you determine user intent, cluing you into what your users want.

    Ideally, you’ll see trends in what brings people to your 404 page, and you can apply that knowledge to adjust your website accordingly.

    Let's say, a 404 page can highlight you a new service you may provide but you didn't think about it before.

    To be continued...

    No comments