Skip to main content

Hey all, 

 

I think I created a funky little function with the help of Supermetrics, to get alerts whenever a 404 response happens on the site (more or less). 

 

How this works is: 

  1. GA4/GTM: You need to have an event that tracks whenever a user visits a 404 page - you can set this up through GTM or GA4 itself
  2. Supermetrics: You pull your 404 data into a sheet thanks to supermetrics
  3. Apps Script: Thanks to a script you install an alert whenever a 404 happens (e.g. every day, every 7 days, every month). You receive an automated email in your inbox whenever a 404 has happened in your chosen timeframe.

The email looks something like this: 

 

 

You can find the details on how to set this up, plus the needed code for apps script, here: 

https://docs.google.com/document/d/1FyaHdzBq2_CMTCU53DT2XBovYoCuyrI8Id5o2YlXB9A/edit#heading=h.kkz9ddaki0go

 

It’s seriously very simple and will help your to stay on top of 404 issues.

Be aware of course that if a user doesn’t accept consent, you won’t know when they have visited a 404 page! It does take a very good part of users though and outputs interesting results.

 

For any questions feel free to reach out :) 

 

Marouscha

Hi @marouscha_dorenbos and welcome to the community 👋

That's a brilliant use case! We love seeing creative uses of our product, and tracking 404s is a smart way to identify broken links and improve the user experience. How do you typically use the data you collect from 404s to improve your website?


I love this solution!

FYI if people are struggling with setting up an event that triggers on a 404, and aren’t comfortable using GTM, here are the steps to set up an event right in GA4:

  1. Go to a 404 page on your website and determine the page title. Hopefully it is something useful like “Page not found”. (I’ll assume that it is Page not found in my instructions)
  2. In GA4, go to Admin > Events > Create Event
  3. Enter a custom event name. Marouscha suggests 404_pages but I usually call this event “page_404” but or honestly whatever makes sense to you works! Just make sure to follow the event naming rules.
  4. In the matching conditions field, you’re going to have two conditions:
    1. First condition:
      1. Parameter: event_name
      2. Condition: equals
      3. Value: page_view
    2. Second condition:
      1. Parameter: page_title
      2. Condition: contains
      3. Value: Page not found
  5. Click Save.

Now you can follow Marouscha’s really useful instructions to get notified when your event happens. Just make sure to enter the correct event name when setting up your alerts.


Reply