Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Track browser size in Google Analytics (not just screen size)
* What this script will do is add a new tracking metric to work out the actual
* size of a browser window (where as Google only tracks screen size). Goes
* great with responsive design!
* Adapted this from Zachstronaut (
_gaq = [
['_trackEvent', 'Browser Dimensions', 'Size', $(window).width() + 'x' + $(window).height()], // Track the browser width and height together
['_trackEvent', 'Browser Dimensions', 'Width', $(window).width(), $(window).width()], // Track the browser width and get average
['_trackEvent', 'Browser Dimensions', 'Height', $(window).height(), $(window).height()] // Track the browser height and get average
var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.