This week, I’ve had the opportunity to attend HighEdWeb, the 2010 edition. During this conference, I’ve been excited to hear institutions are experimenting with and leveraging the new technologies available in HTML5. Whether it’s Christopher Schmitt’s presentation, casual conversations in the hall or even discussions with some of the vendors, HTML5 is on the minds of many developers.
While HTML5 promises to bring much-needed advancements to the web, it is still only in working draft-mode and has not been officially adopted as the new standard. Nonetheless, many browsers have already begun to implement these technologies. For example, the webkit browsers Safari and Chrome have geolocation. Firefox 3.6, webkit and even IE9 have support for the HTML5 video element.
However, none of the browsers support every HTML5 element. Furthermore, the matrix of which browsers support which elements is large and cumbersome. findmebyIP.com has done a great job of presenting this information, but it would be great if Google Analytics could track this for me.
Well, Google Analytics can track this for you! There are two ways to do this: 1) Report on individual browsers and version, compare to the findmebyIP.com tables specific to a particular HTML5 element, and determine if you’ve hit a threshold worthy of utilizing the technology; or 2) use my new script to track this inside Google Analytics for you!
- Download the latest files (available with dual BSD & MIT license, so fork away!).
- Add the JS code below to your pages (preferably alongside your current GA implementation). Check out the example.html file for an, well, example.
- Change the “featuresToTrack” array to allow for the elements you want to track. A list of features is available in Readme.textile or on the github page.
A few things to keep in mind with this code:
- This is experimental. While I have tested in FF 3.6, Chrome 6, Safari 5, IE 7 & IE 8, and everything is working correctly, individual implementations may have issues. Let me know if something goes wrong, and I’ll do my best to help.
- This will only work if you’re using the latest Google Analytics Asynchronous Tracking. If you’re not using Async, this script will not only fail to work, it could cause JS errors.
- Due to character limits in Google Analytics Custom Variables, only a few items can be tracked (total character length needs to be less than 55, inclusive of all tracked features). So pick your items strategically; though, you can always change which items you want to track at any time.
- Speaking of custom variables, this will be stored in slot #5 of GA. If you don’t know what this is, don’t worry. If you do, and you are using slot #5, go ahead and change the script.
Where are the Reports?
You will find these reports in your Visitor Tracking, available under Custom Variables (Visitor > Custom Variables). There will be an entry titled HTML5, and drilling-down farther you will have a list of possible combinations of tracked features based on browser support. From here, you can build Advanced Segments that will help you to better understand visitors to your site with certain HTML5 capabilities and how this trends over time (I see another post in the near future on this topic alone).
Comments, thoughts, suggestions
If you’re having a problem, or you have a better idea, drop in a comment. If you’ve found this helpful or have some examples of how you’re using it, let the community know also with a comment!