No Free Time

Because my therapist says I need to let things out

Archive for June 18th, 2009

Integrating Google Analytics with your Silverlight Streaming application

Posted by andrewmyhre on June 18, 2009

No dice. Can’t be done. Here’s why.

To track an action you need to invoke the trackPage() function defined in ga.js. The function must be invoked from the same domain registered in your Google Analytics account, in my case that’s “andrewmyhre.com”. So in order to track events from my Silverlight app I need to call up to the parent frame and invoke a function to track the event. Unfortunately, because my Silverlight application is running on an entirely different domain (something like “silverlight.services.live.com”) the browser throws a “Permission denied” error when I try to invoke parent.trackPage().

There is no way around this. That behaviour is by design, in order to prevent cross-site scripting attacks.

So I’ve moved the Silverlight and media files to my hosting account where I can load everything under my own domain. That’s cool because I have 1gb of space there and the total media payload is around 500mb. It’s also a real shame, it was cool to be using a new beta service like Silverlight Streaming, but unfortunately event tracking is a deal breaker for me.

Maybe there are some coders out there who know how to get around this, or maybe the Silverlight Streaming team have a workaround… I can’t really see it happening though. Shame.

On the bright side though, the videos seem to be streaming much more quickly now! :/

Posted in silverlight | Tagged: , | Leave a Comment »