Skip to main content
Support home / Event conversions

Track 404/error pages

If you'd like to track what the URL is for 404 pages on your site, you'd do something similar to the above, tracking an event as a pageload, but dynamically add the URL of the page to the event name. By doing this, you'll see which pages people are visiting on your site that don't exist (so you can either redirect those pages or fix broken links to them):

<script>
document.addEventListener('DOMContentLoaded', function() {
var path = window.location.pathname;
fathom.trackEvent('404: ' + path);
});
</script>

So if someone visited usefathom.com/poodcast (which doesn't exist), an event in Fathom would be created called 404: /poodcast to let you know someone visited that URL, which doesn't exist.


If you still have questions or require help with anything, please reach out to us and we'll happily get things sorted out for you.


Can't find what you're looking for?