In this magical realm of digital analytics, the migration from Universal Analytics (UA) to Google Analytics 4 (GA4) has been nothing short of a nightmarish quest for many webmasters and SEO specialists, that has inspired even hilarious video parodies. The lack of certain straightforward functionalities that were staples in UA has left many of us scratching our heads.
Notably, the real-time detection of 404 error URLs—an essential feature for immediate issue resolution—has seemingly vanished, leaving us fumbling in the dark and looking for answers to something that used to be a simple click, on other platforms or technologies. This article aims to light that dark path, detailing a custom workaround to track 404 errors in GA4 real-time reports, sparing you the agony of ineffective support and cumbersome third-party tools.
Why You Need Real-Time 404 Detection
Imagine this: A reader or potential customer clicks on a link to your site only to hit a 404 error page. Every minute that error remains undetected and unresolved, you risk not only losing that visitor but also damaging your site’s SEO performance and user experience. Sometimes Google serves the 404 page on channels like Google Discover, and it is imperative you fix it ASAP, so immediate detection allows you to quickly redirect these URLs and salvage your traffic and rankings.
The GA4 Complication
With UA, spotting a 404 in real-time was a breeze. When the dreadful ‘Page not found’ (or whatever page title you had for your 404 page) popped up in realtime reports, the only thing you had to do was… click, and there it was! But GA4 turned this simple task into a Herculean challenge, omitting straightforward real-time error monitoring and pushing users towards the clunky workaround of Google Tag Manager or other analytics platforms that only add to your site’s script bloat.
Moreover, if you search the web on the matter, the vast majority of the articles around it only mention how to see the 404 pages on GA4’s standard reports — which is not what we’re looking for, since those reports usually get populated with data a day after, terribly long time to wait for an issue like this to be addressed.
To add insult to injury, if you contact Google’s support on the issue (even if you reach the engineering team), their reply is — exact quote: We are sorry that this feature is not available and we hope you understand our limitations.
UN-ACCEPT-ABLE.
A 2-Step Custom Solution
Thus, frustrated by the opaque responses from GA4 support and the labyrinthine suggestions online, we took matters into our own hands and managed to fix the issue simply, and surprisingly enough, within GA4 (we seem to know the tool better than… Google).
Here’s a straightforward, effective method to detect 404 URLs in real-time using GA4:
Step 1: Set Up a Custom Event
Firstly, we’ll need to create a custom GA4 event specifically for capturing 404 errors. This begins by going to the Admin > Data display > Events section of your account (of course, you need admin privileges to do so) and creating an event by clicking on the ‘Create event’ button.
The next part is to name your event (we have opted for ‘detect_404’ on our accounts — make sure not to use spaces, case is sensitive, and you cannot start with a number) and add the following conditions and parameters, as shown in the screenshot below.
Matching conditions:
Parameter | page_title |
Operator | contains (ignore case) |
Value | Page not found |
Parameter configuration:
Make sure Copy parameters from the source event is ticked
URL | [[page_location]] |
page_location | [[page_location]] |
location_id | [[page_location]] |
page_title | [[page_location]] |
You can save this event and now, it will check if the page title contains what you entered — in our case, ‘Page not found’ — and if so, triggers our custom event to GA4’s reports.
Step 2: Test your Event
Now that you’ve set up your event, you can monitor 404 errors in real-time directly from your GA4 dashboard. Navigate to the real-time report, and if there is any 404 page, you will see your event firing. If not, just generate some in various browsers and/or incognito/private mode, by simply entering random characters after your domain name in your URLs, and voilà—observe the event starting to generate some traffic.
Now, the real magic happens; by clicking on the event, you will see the event parameters (both the preset ones — that are very important to have, so it populates the rest — and the ones you added), and by clicking on the top one out of the four we inserted (URL, page_location, location_id and page_title), you will see the problematic URL(s) that is/are causing grief to your visitors.
To take action on those URLs, you simply need to select them (we find that triple-clicking works best), then right-click and copy (GA4 is notorious not to accept CTRL+C/CMD+C on various browsers), and issue your fixes and redirects on your website, or point your webmaster towards the right direction.
Bonus Step: Real-Time Alerts
In GA4 the well known Alerts from UA have been replaced by Insights. If you wish for the event you created to generate an alert you will receive in your inbox, you will first need to make it a Conversion — or as it is now called, a Key Event.
Now, things can get a bit complicated here, as Insights do not allow you to choose a specific Key Event as an alert. That means that if your website is running other Key Events (ie. Ad impressions/clicks, Purchases, Add to carts, etc.), this solution might not be ideal.
If though you do not have or even use Key Events (non-subscription based publishers usually do not), then adding this event and disabling the rest, will allow you to use it as an Insight. Just go to Admin > Data display > Key events, and from there create a New key event, and then just make sure to use the exact same name as the event you created.
After doing this, you may navigate into Insights and create your custom one, selecting it to be Hourly, Property = Web, and choose whether you desire an anomaly to be reported, or a threshold to be set (ie. alert me after the first 50 detections of 404 page views).
If you’d like some help on this, you may check Google’s documentation, or message us in the comments below.
Why This Works
This method cuts through the red tape, providing direct and actionable insights without the need for additional scripts slowing down your site. It brings back a semblance of the good old days of UA, using GA4’s advanced capabilities.
While Google’s transition to GA4 is touted as an upgrade, certain omissions can make it feel like a downgrade. However, with a bit of ingenuity, we can workaround these limitations. This guide not only brings back crucial real-time error page monitoring but does so in a way that maintains your site’s performance and enhances your analytics prowess.
We sincerely hope you found this useful (we did write an article about it, that’s how important we believe it is for skilled webmasters and marketers out there), and will probably probe Google to tackle this without needing a custom event in the future.