Sparkbox has this snippet to help figure out how often browser windows really are resized.
(function() { var resizeTimer; // Assuming we have jQuery present $( window ).on( "resize", function() { // Use resizeTimer to throttle the resize handler clearTimeout( resizeTimer ); resizeTimer = setTimeout(function() { /* Send the event to Google Analytics * * https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEventTracking * _trackEvent(category, action, opt_label, opt_value, opt_noninteraction) */ var $window = $( window ); _gaq.push( [ "_trackEvent", "User Actions", "Browser Resize", $window.width() + " x " + $window.height() ] ); }, 1000); }); })(); Note how easy it is to track events in Google Analytics. That can be used for just about anything.
Pretty cool idea. Is there any reason you wouldn’t cache $(window) up with resizeTimer?
Pretty cool yes but for which purpose do you track such events?