Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2010 Grant Archibald
In this post I will briefly discuss using Google Analytics in conjunction with Silverlight, to track the version installed and your application usage patterns.
Following on from Nikhil Kothari's blog entry on Tracking Silverlight-enabled Browsers via Analytics I have made a few tweaks to the original JavaScript that can be placed at the end of your HTML document after pageTracker has been initialised to provide for the following.
Based on this information it may help you further refine your Silverlight strategy based on your visitors e.g.
Also as indicated in the comments of Nikhil's blog post Jeff Wilcox has a great post Using Google Analytics with rich (managed) web applications in Silverlight that explores how to integrate tracking within your Silverlight application.
<script type="text/javascript">
function getSilverlightVersion() {
var version = '';
var container = null;
try {
var control = null;
var product = 'Silverlight';
if ( navigator.userAgent.indexOf("Linux")!=-1) product="Moonlight";
if (window.ActiveXObject) {
control = new ActiveXObject('AgControl.AgControl');
}
else {
if (navigator.plugins['Silverlight Plug-In']) {
container = document.createElement('div');
document.body.appendChild(container);
container.innerHTML= '<embed type="application/x-silverlight" src="data:," />';
control = container.childNodes[0];
if (control) {
if (control.isVersionSupported('2.0')) { version = product + '/2.0'; }
else if (control.isVersionSupported('1.0')) { version = product + '/1.0'; }
catch (e) { }
if (container) {
document.body.removeChild(container);
return version;
if ( pageTracker )
pageTracker._setVar(getSilverlightVersion());
</script>
Comments [0] Sunday, August 10, 2008 10:16:20 AM (GMT Standard Time, UTC+00:00) Related posts:Three Little Pigs – Silverlight E-BookMy Mix09 10k Contest Entry Is Live – Spin And WinSilverlight BabySmash Audio FilesSilverlight BabySmash Performance – The Asynchronous StoryBabySmash Silverlight Refactorings - Part 2 - Routed EventsBabySmash Silverlight Refactorings - Part 1 - Adding Letters moonlight | silverlight