Skip to content

Instantly share code, notes, and snippets.

@zerostyle
Forked from derekjohnson/resize-monitor.js
Created February 26, 2013 08:31
Show Gist options
  • Save zerostyle/5036984 to your computer and use it in GitHub Desktop.
Save zerostyle/5036984 to your computer and use it in GitHub Desktop.
if(window.addEventListener) { // correlates with media query support
var timer = false
, resize_monitor = function() {
if(timer) {
clearTimeout(timer);
}
timer = setTimeout(function() { _gaq.push(['_trackEvent', 'Resize', 'Resize', 'Resized']); }, 100);
// or log a pageview on a non-existant page if you prefer
// timer = setTimeout(function() { _gaq.push(['_trackPageview', '/resized.html']); }, 100);
}
;
window.addEventListener('resize', resize_monitor, false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment