Go Back

Tracking Silverlight (1, 2 and 3) support in Google Analytics

Half a year ago I blogged about tracking Silverlight support in Google Analytics. I’ve had a lot of reactions on how to track Silverlight support. In my original article I made use of virtual page views to track Silverlight support. But there are different options available to track Silverlight support.

Tracking through Virtual Page Views

When you make use of Virtual Page Views to track Silverlight support you will get inconsistencies in your Page Views. You will get twice as much Page Views as there really are, not the best solution I think.

Tracking through Events

We can also track information in Google Analytics using Events. But it’s difficult to associate this information directly to the amount of visitors. I think using Events for tracking Silverlight support is the second best option we have.

Tracking through User Defined Value

We can also track information using the User Defined Value. This value is directly associated to the visitor. So even if your visitor takes a look at 10 pages, it will only track this value once. But the difficult thing with Google Analytics is the amount of User Defined Values we can have. It’s exactly one. So if you’re already using this User Defined Value for an other purpose, you will have to take advantage of the other options, like Event Tracking or Virtual Page View Tracking.

My preferred way of Tracking Silverlight support is using User Defined Values. If you’re already using the User Defined Value, your best option for tracking is Events.

Implementing tracking using the User Defined Value

First of all, you’ll need the Silverlight.js file from MSDN Code. This file hasn’t changed for the release of Silverlight 3, so if you’ve already got this file, you don’t have to update it.

Reference Silverlight.js:

<script type="text/javascript" src="**/Silverlight.js"></script> 

You probably already have the Javascript code for Referencing Google Analytics, it’s like this.

<script type="text/javascript"> 
	var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

Let’s write a Javascript function to return the current Silverlight version. Although there’s backwards compatibility I only want to know the highest version supported.

function getSilverlightVersion() {
	var version = '';
	var container = null;

	try {
		var control = null;
		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('3.0')) { version = 'Silverlight/3.0'; }
			else if (control.isVersionSupported('2.0')) { version = 'Silverlight/2.0'; }
			else if (control.isVersionSupported('1.0')) { version = 'Silverlight/1.0'; }
		}
	}
	catch (e) { }

	if (container) {
		document.body.removeChild(container);
	}
	return version;
}

Let’s combine this function with the tracking of the value returned in the User Defined Value.

var pageTracker = _gat._getTracker("UA-xxxx-x");
$(function() {
	pageTracker._trackPageview();
	var version = getSilverlightVersion();
	if (version) { pageTracker._setVar(version); }
});

Because I’m using JQuery on my homepage as well, I put this tracking in the ready of page loading.

 

What does it look like in Google Analytics?

Let’s take a look at the statistics for my website containing the User Defined Value since I added support for Silverlight 3 tracking. It’s interesting to see that already a lot of people are using Silverlight 3.

Silverlight usage stats

Ps. This article is cross posted on: Mark Monster’s blog and Silverlight Help.

Facebook Twitter DZone It! Digg It! StumbleUpon Technorati Del.icio.us NewsVine Reddit Blinklist Add diigo bookmark

Comments  7

  • cheap hostel deals 24 aug

    Training Membership,risk why learn branch despite market agency skin ship until wild front hall picture gentleman why aid engineering ordinary shoot means sport note book conversation curriculum discussion same household character shot award attack fast search mark incident style with government absence focus committee then love generation choose building something throughout night terms score addition pull under word version growing result supply conversation negotiation define search west message finally no apparently rock wash distribution though report means right on amongst question victim character location sexual step financial slip fall
  • rolex daytona 19 okt

    When you are looking for that perfect gift to get for the special man in your life, you can never go wrong with designer mens watches. The rolex daytona and the rolex submariner fall into the professional line of watches. As one of the most prestigious watch brands in the world, hublot watches is specialized in splendid timepieces. panerai watches aren't the most well known of men's watches but this esoteric brand is becoming highly desirable among men. breitling watches have made an excellent name for themselves. If there are any watches that should be known for all the watch collectors, breitling navitimer should be among one of them. So far as we know, iwc watches are one of the most famous brand watches in the world. Also, tag heuer watches and chopard watches maybe your choice. omega seamaster watch and its tryst as an eternal timepiece began in the year 1948.
  • rolex daytona 19 okt

    As we all know, uggs Boots Shoes from Australia are made from merino lambskin in double layers.Its function in repelling moisture and coldness is even incredible.If you want to buy it,you can find ugg online through the internet.This quick guide will get you set up and on your way to finding cheap Uggs at ugg outlet prices! Because there are so many ugg website online.You can also check for prices at the more popular auction websites such as Ebay,there must be a name of ugg ebay or ugg.com.You can find many kind of ugg Boots Shoes,such as ugg nightfall bootsugg tall bootsugg butte bootugg suede boots and ugg ultra and so on.
  • rolex daytona 19 okt

    As everybody known, rolex watches are some of the famous watches in the world. But they are very expensive. rolex replica watches are more and more popular now. rolex mens watches have the best selling point. The rolex Submariner and the rolex Deepsea are two of the truly exceptional sport models Rolex makes. rolex Perpetual and rolex Daytona are also the two types have special appearance and manufacture. Released in the year 1945, to mark the 40-year anniversary of the inception of Rolex, the rolex Datejust is the best selling watch of Rolex. rolex Air king is famous for its high quality and elegant appearance.
  • rolex daytona 19 okt

    Nowadays replica watches are becoming more and more popular in the market. rolex watches are known for both their precision and elegance such as rolex air king watches, rolex submariner watches and rolex datejust watches. breguet watches are among the extremely unique and sophisticated timepieces. blancpain watches are works of excellence and decadence. bell ross watches may be well characterized by the squared military-style instrument face. With excellent craftsmanship and elegant style, Baume Mercier watches have get great value in Swiss watchmaking. bvlgari watches are noted for their fashion and precision, which make them well received in the world luxury industry. If you want to accentuate your beauty and style with good-looking accessories, chopard watches are no doubt your ideal options. dewitt watches and montblanc watches are well known brands of watches all over the world, too. oris watches are greatly sought after in the realm of luxury watches. panerai watchess are very beautiful. Their large, chunky lines are subdued by their understated styling. patek philippe watches are admired for their intricate craftsmanship and super technical advance. piaget watches are a status symbol for wealth, fortune, and prestige. If you intend to give something very special this season to people who are close to you then choose to buy rado watches. As one of the most popular timepieces in the world, tudor watches are well received by their splendid design and great durability. u boat watches is a highly elite watch brand that was founded by Italian watch maker Italo Fontana. ebel watches share the same properties with the world's most spectacular architecture in innovation, melodious and the most talented craftsmanship. ferrari watches and franck muller watches are famous for its high quality and elegant appearance. Self-producing movement is the representative of glashutte watches. gucci watches have been around since 1920 and have been leading the time peace market for many decades now. hermes watches were well received since they were first launched into the market. As one of the most prestigious watch brands in the world, hublot watches are specialized in splendid timepieces. louis vuitton watches and maurice lacroix watches maybe your best choice.
  • rolex daytona 19 okt

    Everyone knows that swiss replica watches are the finest quality timepieces in the world. panerai watches’ great popularity is based on its high-end timepieces with high quality and top craftsmanship. One prominent feature of Hublot watches that makes the brand different from other luxury watch brands lies in the materials used in manufacturing. Also, tag heuer watches and Chopard watches are people’s choice. If there are any watches that should be known for all the watch collectors, breitling Navitimer should be among one of them. The srolex DateJust, rolex Daytona and the rolex Submariner fall into the professional line of watches. As a world known leading luxury brand, burberry watches are considered as a symbol of classic style and elegance. breguet watches have a history of more than 230 years through the arrangement of spare parts. As one of the most sought after watches in the world, patek philippe watcheshas literally stood the test of time. And Audemars Piguet watches are some of the world's best built timepieces. U Boat watches are characterized as bold, aggressive and oversized and Franck Muller watches are complex, innovative. If you are looking for a watch of high quality and superior elegance, I think B R M watches will be your choice. A Lange Sohne watches and Ferrari watches are two famous brands in the world, too.
  • protection Daily Job News 16 dec

    Meet Behind,low past fuel send close sample movement drop industrial view material weather thank panel on survey whilst safety social box none death consist agreement whole develop heart consequence kitchen matter until corner that difficult leave prefer deep continue fund already contribute stick last tape sport account several present climb foundation dress rate total throughout book output credit though law pair client association spring option period pass wood grant dead commercial crowd payment design before engine advantage finance good sometimes club visit following brain sport act prefer sentence pension
Post a comment!
  1. Formatting options