Open bennyvasquez opened 4 months ago
I'm not sure how to go about integrating this, I found two ways to do so:
fetch(window.location.href, { method: 'HEAD' })
.then(response => {
if (response.status === 404) {
_paq.push(['setDocumentTitle', '404/URL = ' + encodeURIComponent(document.location.pathname+document.location.search) + ' /From = ' + encodeURIComponent(document.referrer)]);
}
});
Let me know what you guys think :smile: .
I definitely don't want to go the first way, as, like you said, it feels sketchy. Based on what the guide I linked to says, I think the custom 404 page would work. We can then customize it in the future to be more verbose and helpful, too.
By default, it seems, Matomo doesn't track 404s. We need to add this, so I can more easily tell if inbound links are hitting the right place, or identify opportunities for additional content. This guide should allow us to do it with ease:
https://matomo.org/faq/how-to/faq_60/