There's an ongoing debate in the responsive web design community — do users resize their browser windows or not? During our Build Responsively Workshop in Columbus, Ben mentioned that he would love to have a way to track browser resize events. It seemed simple enough, so I put together this gist as a quick proof of concept:
|1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20|| |
This creates a handler for the browser resize event in order to fire a Google Analytics call with the browser dimensions. This solution waits for a 1 second pause before making the call to avoid a problem where some browsers would continuously fire the resize event.
Also, don't miss Andy's article on Google Analytics and the Retina Display.