When Silverlight just lived in the browser, it was relatively easy to interact with the analytics framework of your choice via code; it simply interacted with JavaScript on the browser. This wasn’t terribly designer-friendly, since it required using code unless your developers were clever, but when Silverlight 3 and the out-of-browser experience came around, suddenly developers no longer had the guaranteed access to the analytics JavaScript hosted on the containing web page. In response, Microsoft developed the Microsoft Silverlight Analytics Framework, a plugin-capable API for implementing analytics clients within a Silverlight application. With it, we can now easily add any number of analytics vendors to a single client, without much headache at all, and what’s more, it’s extended to be easy-to-use for designers:
The Analytics API implements behaviors, so that you can simply attach certain actions and behaviors to events on objects, easily in Expression Blend (so easy, a Designer can do it):
Here, Expression is collapsed, but you can see the Analytics TrackAction behavior is selected and can have its properties modified.
Given how often we utilize Google Analytics within our solutions, we were very excited to hear that Google was one of the providers to implement the Analytics Framework. As our ability to track behaviors for our clients grows, we’re especially excited to see where the future of Silverlight will carry this capability – to mobile devices and embedded scenarios, or interactive and offline video players, our ability to monitor conversions and user behavior is only going to grow.











{ 3 comments… read them below or add one }
We’d love any feedback that you have on using the Microsoft Silverlight Analytics Framework – use the discussion forum on the CodePlex site – or contact me directly.
Thanks,
Michael
Michael, thanks for the invitation to comment!
The only thing that is particularly disappointing to me is that the API seems to be focused on Silverlight. Because of its service-oriented nature, it could easily have been generically .NET, and then you could have added a Silverlight or WPF or Windows Forms or any other basic lifetime management dependency. As it is, though, WebAnalyticsService implements IApplicationService and IApplicationLifetimeAware, which creates a specific dependency on Silverlight (and possibly to WPF). Using this API, though, I could have added an analytics logging mechanism to a web service, or perform similar tracking in a WinForms application.
Perhaps I’ll create a fork.
We already thought of that.
If you create a Blend project for WPF, you’ll notice that there are analytics behaviors for WPF as well. They is no design-time assembly yet but they are in the Behaviors section of the Assets pane. The source code for the WPF version (which is 99% the same as Silverlight) is in CodePlex and ships in the framework as well. There is a TrackApplication behavior for WPF which does similar functions as the WebApplicationService.
Look here C:\Program Files (x86)\Microsoft SDKs\Microsoft Silverlight Analytics Framework\wpf
I guess your next question is whether the GoogleAnalytics would work there – we can do a build of it for WPF but we want to make sure it will work in non-web-page context first. Contact me offline and we can have a discussion with Google about it.