Track your 404 traffic the smart way

When I moved into a static website made using Hugo I optimised almost everything, including the Google Analytics script. Instead of bulky code loaded from Google, I used Minimal Analytics .

Initially, I put it as always, in the head of my website. Later on, I added it to my 404.html page. I created my own 404 page to override the default Netlify landing page that appears when the visited URL was not found.

The idea was initially to find broken links that visitors are using and to fix them with relevant redirection. However, it didn’t take long until my analytics were spammed by stupid people (and their bots) trying to find a way to break in to my site.

Despite that, on a static website, there is nothing to break in. “The internet” remembered that I was using WordPress before, so they keep trying to use known vulnerabilities to break into it.

Of course, these attempts were pointless, and they always land on the 404 page.

WordPress on my website is long-term gone and will not come back however I still would like to know what happens on the 404 page.

Luckily, Google Analytics offers the ability to create a property with its own tracking code. You can have your own account, and on it have separate tracking codes for a different purpose.

Assuming that you use one account (do not mix with Google Account) per website then the main property is used for tracking your main website and any other to track different parts, and they are not mixing with each other.

In such a way, I created an additional property that I called 404 Junk Collector and through advances options I created the Universal Analytics property. This gives me the UA tracking code that later, using Minimal Analytics, I implemented it into my 404.html page.

This property will not be a thing, that I will be looking at very often, but more rather from time to time and see what happens in the background.


After migrating from WordPress I noticed a big drop in traffic which resulted not in the loss of true visitors but more rather bots trying to scan my website to find weak points.

Having 404’s in your main traffic gave false assurance about the true meaning and need of the existence of your website.

If, for example, from 1,000 visits you drop to 500 on static site, after excluding 404’s you land in like 250. That’s your real target audience on which you need to concentrate your efforts and the content that you create.


You may live without knowledge of what is happening on the 404 page and nothing bad will happen, especially when your website is static, but from time to time, especially after updating some old posts its worth having a look if we didn’t break something, and because of that not losing our precious visitors. Right implemented redirection rule may save us precious time regaining lost traffic.

Do you find my website useful?

My site doesn't serve ads, and content is provided for free.
To support me, you can buy me a coffee.

Buy me a coffee

If you cannot, I will appreciate if you can share my post.

Comments