WP7 How to do google analytics via code, without javascript

Sep 29, 2010 at 3:52 PM
Edited Sep 29, 2010 at 3:54 PM

In silverlight, I can do something like:


var gat = (ScriptObject)HtmlPage.Window.GetProperty("_gat");
var tracker = (ScriptObject)gat.Invoke("_getTracker", accountCode);
var tracker.Invoke("_trackPageview", "mypage.xaml");


I would like to do the same in WP7 (Windows phone 7). 

I do not have an HtmlPage and I prefer not to embed a WebBrowser object to achieve the same.

I want to do this in event handlers in code and avoid using google tags in the xaml.

Is there a simple "_gat" equivalent available for WP7 that I can simply start using ?


Sep 30, 2010 at 5:41 AM
Edited Sep 30, 2010 at 5:42 AM

There is no simple _gat equivalent.  Read the help topics:

  1. How to Track an Event from Code
  2. How to Add Tracking to Windows Phone Applications

Please explain why you want to avoid using the GoogleAnalytics element in your App.xaml.