Skip to content

Use Google Analytics to track HTML 5 browser support for dozens of features

Notifications You must be signed in to change notification settings

smeranda/trackHTML5inGA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Track HTML5 in Google Analytics (trackHTML5inGA)

Introduction

A simple addition that allows for tracking of HTML5 feature sets in Google Analytics

trackHTML5inGA is simple tool that utilizes the Google Analytics Async implementation to
track the available HTML5 features of each site visitor’s browser.

This script leverages the powerful [http://www.modernizr.com/](Modernizr) HTML5 detection
Javasript library and extends it by utilizing the Google Analytics Custom Variable Visitor Tracking to track
which available features are present.

Copyright © 2010 Seth Meranda – http://seth.meranda.org/

Track HTML5 in Google Analytics (trackHTML5inGA) is dual-licensed under the BSD and MIT licenses.

More information available at [http://go.unl.edu/trackHTML5inGA](http://go.unl.edu/trackHTML5inGA)

Implementation

To use this, you must add the following code inside your page, after your initial Google Analytics variable (_gaq) is setup:

	
	<script type="text/javascript">
		featuresToTrack = ['video','audio']; // set this array with the features you want to track. **Note max character count is 55 inclusive
		(function(d, t) {
			var s=d.createElement(t),x=d.getElementsByTagName(t)[0];
			s.async=1;s.src='js/trackHTML5inGA.min.js';
			x.parentNode.insertBefore(s,x);
		})(document, 'script');
	</script>
	

Note this line in particular:

	
		featuresToTrack = ['video','audio']; // set this array with the features you want to track. **Note max character count is 55 inclusive
	

This is what controls which features to track. Due to a Google Analytics length limit, you must keep this to less than 55 characters, inclusive.
This is an array that can take any of the following values:

	flexbox
	canvas
	canvastext
	webgl
	touch
	geolocation
	crosswindowmessaging
	websqldatabase
	indexeddb
	hashchange
	historymanagement
	draganddrop
	websockets
	rgba
	hsla
	multiplebgs
	backgroundsize
	borderimage
	borderradius
	boxshadow
	opacity
	cssanimations
	csscolumns
	cssgradients
	cssreflections
	csstransforms
	csstransforms3d
	csstransitions
	_fontfaceready
	fontface
	video
	audio
	localstorage
	sessionstorage
	webworkers
	applicationcache
	svg
	inlinesvg
	smil
	svgclippaths

Reporting

The values will be available in your Custom Variables report.

About

Use Google Analytics to track HTML 5 browser support for dozens of features

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published