Google Analytics not raising TrackEvent

Apr 9, 2010 at 1:20 AM

I've been trying to get GoogleAnalytics to work but seem to be doing something wrong. I started off by following the documentation:

- Created new Silverlight Navigation project
- Added GoogleAnalytics to LayoutRoot (and set Web Property ID based on my Google Analytics account)
- Added TrackAction to the ContentFrame (set SourceName to be ContentFrame, although that should be the default as ContentFrame is parent. Also set EventName to Navigated)

Ran application with Fiddler running and didn't notice any calls to Google.

Think that I must had done something wrong I added a ConsoleAnalytics to the LayoutRoot and ran the application with the IE8 dev tools running. The Navigated events are raised correctly in the console.

Wondering where I could be going wrong I decided to create a class GoogleExt that inherits from GoogleAnalytics. I then attached an event handler to the base.Events.TrackEvent in the overrided OnAttached method. I then exchanged my GoogleExt for the GoogleAnalytics in my application. Unfortunately when I ran the application the TrackEvent event isn't being raised. Note that if I do the same but inherit from ConsoleAnalytics the event gets raised.

For some reason I suspect my GoogleAnalytics instance (either GoogleAnalytics or my overridden GoogleExt) aren't being correctly attached - The OnAttached method does get called and returns without throwing an exception.

Any suggestions as to what I might be doing wrong?

Apr 9, 2010 at 3:23 AM
Edited Apr 9, 2010 at 3:25 AM

You need to add the Microsoft.WebAnalytics.Navigation assembly to the project. 

There is also a bug in the Google Analytics component that may be inhibiting Google Analytics tracking of naviation events. This is related to the bug which we are in the process of fixing.


Apr 9, 2010 at 3:26 AM

Thanks for that - should have checked the open issues list before posting (my bad).

Is there a hack/workaround for getting this to work with the current bits? Even if it's a contrived example of working with Google analytics I just want to have it raising some event.


Apr 9, 2010 at 3:36 AM

I just checked in an updated GoogleAnalytics.WebAnalytics.dll - you can get it from the source tree at


Please tell us if it fixes the problem.

Apr 9, 2010 at 3:58 AM

Nope, doesn't seem to work still.  Do you have a simple sample you can post that show it working? My scenario of creating a new Silverlight Navigation project and adding tracking would be a great candidate?


Apr 9, 2010 at 4:03 AM

Did you add the Microsoft.WebAnalytics.Navigation assembly?


Apr 9, 2010 at 4:07 AM

Yes, even tried updating all the assemblies (not just Google.WebAnalytics.dll) to those from the repository.

Apr 9, 2010 at 4:22 AM

I just checked in a project DemoNavigation into the source tree - as confirmed with Fiddler, this send data to Google Analytics.

Please tell me what you did differently so I can update the documentation or fix it.

Apr 9, 2010 at 5:06 AM

Just created and zipped a sample solution - Let me know if this works for you. 

Apr 9, 2010 at 5:11 AM

That works fine for me.  I'm even getting your dialog box popups.

Here is the Fiddler trace:*Navigated*ContentFrame)8(1!ActionValue)9(1!/Home)11(1!3)&utmcs=utf-8&utmul=en-us&utmsr=999x619&utmsc=32-bit&utmdt=SilverlightApplication7&utmp=/Home&utmhn=localhost&utmr=-*Navigated*ContentFrame)8(1!ActionValue)9(1!/Home)11(1!3)&utmcs=utf-8&utmul=en-us&utmsr=999x619&utmsc=32-bit&utmdt=SilverlightApplication7&utmp=/Home&utmhn=localhost&utmr=-*Navigated*ContentFrame)8(1!ActionValue)9(1!/About)11(1!3)&utmcs=utf-8&utmul=en-us&utmsr=999x619&utmsc=32-bit&utmdt=SilverlightApplication7&utmp=/About&utmhn=localhost&utmr=-*Navigated*ContentFrame)8(1!ActionValue)9(1!/About)11(1!3)&utmcs=utf-8&utmul=en-us&utmsr=999x619&utmsc=32-bit&utmdt=SilverlightApplication7&utmp=/About&utmhn=localhost&utmr=-*Navigated*ContentFrame)8(1!ActionValue)9(1!/Home)11(1!3)&utmcs=utf-8&utmul=en-us&utmsr=999x619&utmsc=32-bit&utmdt=SilverlightApplication7&utmp=/Home&utmhn=localhost&utmr=-*Navigated*ContentFrame)8(1!ActionValue)9(1!/Home)11(1!3)&utmcs=utf-8&utmul=en-us&utmsr=999x619&utmsc=32-bit&utmdt=SilverlightApplication7&utmp=/Home&utmhn=localhost&utmr=-

Apr 9, 2010 at 5:12 PM

I was able to fix the problem and uploaded a new version of


Please try it out and see if it works.


Apr 10, 2010 at 2:45 AM
Edited Apr 10, 2010 at 2:46 AM

Thanks for resolving this issue - works like a treat!


Nick Randolph | Built To Roam | Microsoft MVP - Device Application Development | +61 412 413 425
The information contained in this email is confidential. If you are not the intended recipient, you may not disclose or use the information in this email in any way. Built To Roam does not guarantee the integrity of any emails or attached files. The views or opinions expressed are the author's own and may not reflect the views or opinions of Built To Roam. 




May 4, 2010 at 2:15 PM
Edited May 5, 2010 at 12:08 PM
nickrandolph wrote:

Just created and zipped a sample solution - Let me know if this works for you. 


How did you make this work? I can't make Google Analytics work for me. I can get into breakpoint inside OnAttached(), but never get into the EventsHandler. And I am using this very same application you've created.

Edit: Everything works fine with the latest installer release for SL4 & Expression Blend 4.