28 February 2009 - 11:40 PM / by Dominic Pettifer. 1 Image for Add Silverlight Tracking to your Google Analytics. 1 Comment for Add Silverlight Tracking to your Google Analytics.
Technical Article - Use this handy JavaScript to add Silverlight Tracking to Google Analytics, and see what percentage of your users have Silverlight installed, including which versions.
If you run a website and haven't hooked up Google Analytics yet (or any other form of user tracking/web analytics system) then what's wrong with you!? GA is a very powerful tool that gives you detailed information about your visitors. Simply add a piece of JavaScript your websites footer, and it lets you see how many visits, total page views, average page views per user, what pages they are going to, how long they're staying on your site, plus many more besides.
You can also track visitor's browser capabilities, such as which Browser, version, screen resolution, colour depth, operating system and whether they have Java Applets and Flash enabled/which versions etc. Useful to know if you're deciding on a minimum screen resolution to support for your next website, or whether to continue supporting IE6, for example. Basically, you'll gleam a lot more information than from just looking at your server logs.
Unfortunately, there is no Silverlight tracking built into GA yet, but it does let you do your own custom logging. Add the following JavaScript somewhere in your site (external script file for instance):
function getSilverlightVersion()
{
var version = 'No Silverlight';
var container = null;
try
{
var control = null;
var product = 'Silverlight';
if (navigator.userAgent.indexOf("Linux") != -1)
{
product = "Silverlight (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;
}This Silverlight tracking code comes from Grant Archibald's blog, many thanks to him for providing this excellent function. You don't need to be using Silverlight on your website to use this function, and has no dependencies with Google Analytics, it could be used with any analytics engine as all it does is return a string. I've made a minor change, it returns "No Silverlight" instead of a blank string when Silverlight is not installed on the user's computer so we can filter Silverlight stats in GA, as we'll see later on.
Now in the footer of your website where your Google Analytics tracking code is set up, add the line pageTracker._setVar(getSilverlightVersion()); just before the line pageTracker._trackPageview(); so it looks something like this:
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-2689687-37");
pageTracker._setVar(getSilverlightVersion());
pageTracker._trackPageview();
} catch(err) {}
</script>Now wait until next day, and you should start to see some results in the 'User Defined' section under 'Visitors'. You may have other user defined values here so use the filter box to filer on the word 'Silverlight'.
The Google Analytics API does seem quite powerful, allowing you to track custom events whenever the user does something within the web page, and not just page visits. For instance, you can track when a user presses the Play, Stop & Pause functions on a video player, or track how often they try to drag 'n' drop widgets/gadgets around the page.
I recently added this code to a website I worked on, Borders Health In Hand. The tracking code has only been installed for a few days, so the sample is only from about 400 visitors, but we're seeing around 14.4% of users with Silverlight 2.0 installed, and 5.3% with version 1.0.
Bearing in mind this is a very mainstream, non tech-savvy, government website in the UK, so 14.4% isn't a bad showing for Silverlight 2.0, but is long way away from the 85% of our visitors with Flash installed (although Flash 10 only accounts for 40%). It'll be interesting to see usage stats for my own website. They should be higher given the unique audience (mainly .NET developers). I'll add the tracking code and report back.
Hi there
Ever since we started using this there has been a massive increase in the statistics for Visitors -> Browser Capabilities -> Flash Versions -> (not set). The number of people with a Flash version that is not set has jumped to around 85%.
Do you know what might be causing this and/or how to fix it?
Cheers!
James
Posted on 8 January 2010 - 1:04 AM / by James
ls. The illustration IWC Aquatimer watches are since abiding thanks [url=http://www.cheapwatchse.com]knockoff wrist watches[/url] to the discriminative IWC watches. allow the IWC Aquatimer effigy [url=http://www.cheapwatchse.com]watch knockoffs[/url] Watches thanks to a going point and abiding guide that [url=http://www.cheapwatchse.com]watch knockoffs[/url] is 100% irrigate unaffected. ril 28 to May 31 period, [url=http://www.cheapwatchse.com]buy knockoff watches[/url] influence ingredient individual of the Movado watch, Movado onus perform [url=http://www.cheapwatchse.com]knockoff mens watches[/url] sent spell a fortunate draw, winners leave rest assured the [url=http://www.cheapwatchse.com]knockoff watch[/url]
Posted on 10 May 2011 - 8:13 AM / by cheap knockoff watches
Newest styles of <a href="http://www.christianlouboutinreplicacl.com/"><strong>christian louboutin high heels</strong></a> in hot sale now, <a href="http://www.christianlouboutinreplicacl.com/"><strong>Christian Louboutin Knockoffs</strong></a> shoes sale now, buy <a href="http://www.christianlouboutinreplicacl.com/"><strong>christian louboutin replica</strong></a> in our online uk store .your shoes sales prices will save.
Posted on 22 September 2011 - 2:42 AM / by christian louboutin replica
Result of Stored Procedure using output params and a recordset (from the blog Output Parameters AND Recordsets From a Stored Procedure )
And YouTube still auto-fucking-plays videos!! This is TWO-THOUSAND-AND-FUCKING-TWELVE FFS!!!
about 20 hours ago from webOn a side-note, YouTube's commenting system is god-awful atrocious dreadful horrible horrible horrible!! Constant meaningless error messages
about 20 hours ago from webJavaScript is slow mmmkay http://t.co/NbB4eQjw - Actually, no, it's not http://t.co/kpGEIoPO #nodejs
about 20 hours ago from webTFS: It's super expensive, so it must be brilliant, right? Like Sharepoint #tekpubtfstitlesuggestion
5:22 PM February 3rd from web