开发者

How can I track HTML5 browser features (modernizr) using Google Analytics?

I've been using Modernizr for a short while to style my site based on the user's browser functions. I've also been using Google Analytics for some time, but haven't done a whole lot with custom variables..

Basically, I'd like to combine these two features; I'd like to report to Google what features the user's browser supports. In Google analytics, I'd like to see what percentage of my users have browsers that support SVG, for instance, or have flexible box support.

How should this problem be approached? I'm aware that Google has a very limited number of Custom Variables at my disposal. If 开发者_JAVA技巧I put all of the body's final classes into a string and post it as one custom variable, will I be able to segment my data appropriately within Google?

Thanks for any ideas or insight.


Google analytics can be called manually in Javascript using calls such as pageTracker._trackPageview();. It's fairly simple code. See the Analytics API manual for the other function calls that are available and example code.

Modernizr sets a Javascript variable for each property it checks. It should be simple enough to write an if() block to look at that property and make different _trackPageview calls dependant on the result of the if().


You can’t easily track all of Modernizr’s individual features and make them easily usable with Google Analytics.

However, you can use the Modernizr results table to get an overview of what each individual browser supports, and then cross-reference that with your audience's browsers from Google Analytics.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜