-
-
Save metinsaylan/2873a7b81e51982d1c6fb6ca8e92d584 to your computer and use it in GitHub Desktop.
Track 404 errors as events with Google Universal Analytics, capturing the referrer as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
// Track 404 errors with Universal Analytics | |
if($('body').hasClass('error404')) { | |
ga('send', 'event', 'error', '404', 'page: ' + document.location.pathname + document.location.search + ' ref: ' + document.referrer, {'nonInteraction': 1}); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment