views:

751

answers:

5

I'm trying to get some stats on how many of the visitors to our website have Silverlight enabled browsers.

We currently use Google Analytics for the rest of our stats so ideally we'd like to just add 'Silverlight enabled' tracking in with the rest of our Google Analytics stats. But if it has to get written out to a DB etc then so be it.

Nikhil has some javascript to Silverlight tracking to Google Analytics. I have tried this code but Google Analytics doesn't pick it up.

Does anyone have any other ideas/techniques?

Thanks in advance for any help/ideas.

A: 

I think you answered it yourself. The page you are linking to does just that: detect which version of Silverlight the user has (not if s/he installs it). From the page:

After a little poking around, I found that Google Analytics has support for reporting a user-defined field.

...

Basically this detects the presence of Silverlight, and if its available, it records the version as the value of the user-defined field. Now your analytics reports will have one of three values: "(not set)", "Silverlight/1.0" or "Silverlight/2.0".

Cd-MaN
+1  A: 

In case you missed it, there's a link to a more detailed article as well in the comments: http://blogs.msdn.com/jeffwilcox/archive/2007/10/01/using-google-analytics-with-rich-managed-web-applications-in-silverlight.aspx

Edit: As David pointed out, this article covers the reverse scenario more (how to write your silverlight app so that it plays well with Analytics).

Vaibhav
A: 

@Vaibhav
The Using Google Analytics with rich (managed) web applications in Silverlight article is very interesing but is more focused on how to get your Silverlight app to send messages to Google Analytics.

@Cd-MaN Yeah, I thought that too but I have tried running my page with Nikhil's javascript and Google Analytics didn't pick it up. But I could have screwed something up somewhere.

I'm just interested to know if anyone else has managed to do this (track Silverlight-ness) successfully.

David HAust
A: 

I've written a lightweight Silverlight library that helps make it easy to integrate Google Analytics in your silverlight app. You can grab download the code or binaries here.

Cory R. King
A: 

I think the code posted on Nikhil's blog is out of date if you are using ga.js and not urchin.js.

The use of the global function __utmSetVar() is replaced by the tracker method _setCustomVar()

http://code.google.com/apis/analytics/docs/gaJS/gaJSApiBasicConfiguration.html#_gat.GA_Tracker_._setCustomVar

mdarnall