Skip to content

Instantly share code, notes, and snippets.

@Neolot
Last active October 8, 2018 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Neolot/dbf8b2916813f0b3a62604efd9c3dd38 to your computer and use it in GitHub Desktop.
Save Neolot/dbf8b2916813f0b3a62604efd9c3dd38 to your computer and use it in GitHub Desktop.
Track 404 error with Universal Analytics
<script type="text/javascript">
ga('send', 'event', 'error_404', '<?php echo $_SERVER['REQUEST_URI']; ?>', '<?php echo ($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'direct'; ?>');
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment