This project is read-only.
Project Description
Integrates google analytics into silverlight application.

Please note that only new Asynchronous Tracking Code is supported.


1. Add google analytics tracking code into silverlight hosting page (see for details).

2. download latest release and add reference to FTG.Silverlight.Google.Analytics.dll into your silverlight project, Alternately add reference via nuget (

3. Code sample

using FTG.Silverlight.Google.Analytics;

//track page

//track event
Tracker.TrackEvent("MyCategory", "MyAction");

//track event with label
Tracker.TrackEvent("MyCategory", "MyAction", "MyLabel");

Track supported silverlight version

To track supported silverlight version use SilverlightUtils.js.

SilverlightUtils.getInstalledSilverlightVersion() function will return major and minor silverlight version
as string (for example "4.0") or null if client doesn't have silverlight or turned it off in browser.

The following example shows how to use custom variable to track supported silverlight version:

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

        var slv = SilverlightUtils.getInstalledSilverlightVersion();
        slv = slv == null ? "Not supported" : slv;

        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-XXXXXXXXX']);
        _gaq.push(['_setDomainName', '']);
        _gaq.push(['_setCustomVar', 1, 'SilverlightVersion', slv, 2]);

        (function () {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);


Last edited Apr 23, 2012 at 11:15 PM by phnix19843, version 3