I’ve been wanting to add google analytics tracking to the Khan Academy app, but have been putting it off for a while since it looked like the only option was to use the Silverlight Analytics Framework. There’s so many things wrong with that distribution:
- Overly complex to support N number of different trackers … enterprise software at it’s “best”
- Binary distribution is only via MSI installer! seriously, in this day and age, either give me a NuGet package, or at worst just give me the .dlls.
- Even though it’s open source, looking through the code is an exercise in futility (see point 1). I considered going in and extracting just the code for GA, but it’s not even obvious where that is in the codebase … admittedly, I only browsed around through the online codeplex browser.
Thankfully, Justin asked me yesterday about adding GA to his MonoDroid project. I hesitantly pointed him to the MSAF library, but kept searching when I finally came across Maarten Balliauw‘s sweet implementation of a GoogleAnalyticsTracker for asp.net mvc. He was able to quickly adapt the code for his monodroid project; and because GitHub is awesome, I also forked it and added a new project that lets you build the solution for Windows Phone. You can find it here: https://github.com/joelmartinez/GoogleAnalyticsTracker
And then sent back a pull request for the changes That’s the great thing about open source, done GitHub style. I’m free to make (and share) the changes I need … and if they are good enough, they can easily make their way back into the original/main project. Awesome.
Edit: Maarten quickly accepted my pull request, and even adjusted the NuGet package to include the windows 7 build. With that, I deleted my fork as I wasn’t planning on making any additional changes in the immediate future. So you can find the latest here: https://github.com/maartenba/GoogleAnalyticsTracker