Skip to content

Instantly share code, notes, and snippets.

@stereobooster
Created August 2, 2012 08:27
Show Gist options
  • Save stereobooster/3235421 to your computer and use it in GitHub Desktop.
Save stereobooster/3235421 to your computer and use it in GitHub Desktop.
Track 404 with google analytics
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview', '/404?p=' + encodeURIComponent(document.location.pathname + document.location.search) + '&r=' + encodeURIComponent(document.referrer)]];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment