Trigger email on 404


(Serge) #1

Matrix Version:

Hi,

Is there a way to send an email to someone when a user encounter a 404? We’d like to veer away from broken links report and have more of a client-triggered link fixing approach.

Cheers


(Douglas (@finnatic at @waikato)) #2

If you can set something so that a triggered email only gets sent once daily, that might work around a potential flood of emails.

I’d strongly suggest you get a report generated from your server logs on actual 404’s handled / recorded before proceeding with a email triggered when a 404 error occurs.

We get a large number of 404’s daily from security scans (people looking for wp-login.php or similar) or icons that we haven’t setup (e.g. apple-touch-icon-*). Depending on your environment (public / private / intranet) your mileage may vary but you may find that the server is logging / handling 400 type errors that don’t turn up in broken link reports.


(Bart Banda) #3

You could potentially have a piece of client side JS that fires on the Page Not Found page, which fires an AJAX call to the Page Not Found asset itself with something like ?sendemail=true in the URL, then use a Trigger to fire on asset accessed on the Page not found page that sends the email.

You could even make it a POST and post related data for things like the current URL, request headers, page referrer etc…

Added an idea in Squizmap to handle this more natively in the interface as well: https://squizmap.squiz.net/matrix/11639


(Peter McLeod) #4

Hi

I’d agree with Douglas re going down the report path to investigate first before setting up triggered emails … I could see being problematic.

Some others options that don’t necessarily address what you are after, but might be useful:

Could also log custom events on browser 404 page loads/exits using google analytics to get reporting.

On our 404 page we get the last path component for pages / or the asset id for files, and send this back to our search engine to provide suggestions on what the user may have been searching for. This is done via client side JS on the 404 asset. We use Algolia as our search service but should be be able to do similar with Funnelback and others.

For example - a url with a misspelt path: https://www.aci.health.nsw.gov.au/innovation-excahnge

There are limited situations where this will be useful, but we find that it is a better user experience to try and find what some one is wanting, than doing nothing.

Thanks
Peter


(Serge) #5

Thanks Guys,

I should have explained my aim better however. It is not to find out what our 404 are, google webmaster tool is good enough for that, second to that, the broken link report.

I have inherited a few sites that, according to the broken link report, has hundreds of broken links. Going through all of those and starting an investigation for each is a massive job. I was thinking “low hanging fruit” of starting with what the users actually encounter as 404 as opposed to a bot crawling the site or the broken link report.

So it is more about finding a way to identify which of those 404 are the priority by how many people are accessing them. Thanks PeterM for the idea, I’ll look into Google Tag manager if I can track a metric for analytics based on 404 pages encountered by users.

Cheers