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

<p>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.  </p>

<p>Nikhil has <a href="http://www.nikhilk.net/Silverlight-Analytics.aspx" rel="nofollow noreferrer">some javascript</a> to Silverlight tracking to Google Analytics.  I have tried this code but Google Analytics doesn't pick it up.</p>

<p>Does anyone have any other ideas/techniques?</p>

[{'answer_id': 37500, 'author': 'Grey Panther', 'author_id': 1265, 'author_profile': 'https://Stackoverflow.com/users/1265', 'pm_score': 0, 'selected': False, 'text': '<p>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:</p>\n\n<blockquote>\n  <p>After a little poking around, I found that Google Analytics has support for reporting a user-defined field.</p>\n</blockquote>\n\n<p>...</p>\n\n<blockquote>\n  <p>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".</p>\n</blockquote>\n'}, {'answer_id': 37505, 'author': 'Vaibhav', 'author_id': 380, 'author_profile': 'https://Stackoverflow.com/users/380', 'pm_score': 1, 'selected': False, 'text': '<p>In case you missed it, there\'s a link to a more detailed article as well in the comments: <a href="http://blogs.msdn.com/jeffwilcox/archive/2007/10/01/using-google-analytics-with-rich-managed-web-applications-in-silverlight.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/jeffwilcox/archive/2007/10/01/using-google-analytics-with-rich-managed-web-applications-in-silverlight.aspx</a></p>\n\n<p>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).</p>\n'}, {'answer_id': 37510, 'author': 'Dhaust', 'author_id': 242, 'author_profile': 'https://Stackoverflow.com/users/242', 'pm_score': 0, 'selected': False, 'text': '<p>@Vaibhav<br>\nThe <a href="http://blogs.msdn.com/jeffwilcox/archive/2007/10/01/using-google-analytics-with-rich-managed-web-applications-in-silverlight.aspx" rel="nofollow noreferrer">Using Google Analytics with rich (managed) web applications in Silverlight</a> article is very interesing but is more focused on how to get your Silverlight app to send messages to Google Analytics.  </p>\n\n<p>@Cd-MaN\nYeah, 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.  </p>\n\n<p>I\'m just interested to know if anyone else has managed to do this (track Silverlight-ness) successfully.</p>\n'}, {'answer_id': 263624, 'author': 'Cory R. King', 'author_id': 16742, 'author_profile': 'https://Stackoverflow.com/users/16742', 'pm_score': 0, 'selected': False, 'text': '<p>I\'ve written a lightweight Silverlight library that helps make it easy to integrate Google Analytics in your silverlight app.  <a href="http://www.codeplex.com/SilverlightAnalytics" rel="nofollow noreferrer">You can grab download the code or binaries here.</a></p>\n'}, {'answer_id': 3323399, 'author': 'mdarnall', 'author_id': 42998, 'author_profile': 'https://Stackoverflow.com/users/42998', 'pm_score': 0, 'selected': False, 'text': '<p>I think the code posted on Nikhil\'s blog is out of date if you are using ga.js and not urchin.js. </p>\n\n<p>The use of the global function <code>__utmSetVar()</code> is replaced by the tracker method <code>_setCustomVar()</code></p>\n\n<p><a href="http://code.google.com/apis/analytics/docs/gaJS/gaJSApiBasicConfiguration.html#_gat.GA_Tracker_._setCustomVar" rel="nofollow noreferrer">http://code.google.com/apis/analytics/docs/gaJS/gaJSApiBasicConfiguration.html#_gat.GA_Tracker_._setCustomVar</a></p>\n'}]
['https://Stackoverflow.com/questions/37495', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/242/']