Google Analytics & WP7: Page Tracking

Sep 27, 2011 at 10:48 AM

I'm a bit confused as to how Google Analytics Page Tracking works in relation to Windows Phone 7. The documentation for Navigation Tracking only relates to Silverlight and I am unclear as to the Windows Phone equivalent (as there is no Navigated event on frames). I can't seem to find a good example in the sample code or online.

It would be ideal if I could perform page tracking from code in a similar manner to how I am already tracking a number of standard events. Is a page track still an AnalyticsEvent or is another class responsible for this? Do I need to set a property to a specific value if it is indeed an AnalyticsEvent that handle page tracking?

If anybody could provide a quick example in XAML or code for GA page tracking that would be very helpful.

Sep 27, 2011 at 10:29 PM

I'm trying to to this using a TrackAction on the Loaded Event and then passing a custom Category value with the View name and it's successfully reporting back to Google Analytics but unfortunately I'm having this issue...

Here's what the XAML looks like but I added this using Blend.

<Interactivity:EventTrigger EventName="Loaded">   
<mwab:TrackAction Category="AccountSummary View"/>   

Sep 28, 2011 at 9:57 AM

Thanks for the reply.

However, when looking at Google Analytics these have gone through as events with Action set as Loaded. Therefore these aren't coming through as Pages. 

I don't think its something I'm doing wrong, the only Page I ever see on my analytics is /app://external/

Oct 6, 2011 at 5:44 PM

Does anyone have anything to add on this subject? Anyone experiencing the same thing or is picking up Page Views successfully?

If not I shall upgrade my problem to an issue/suggested feature.


Oct 17, 2011 at 3:45 PM

For WP7, the MSAF tracks the CurrentScreenChanged event automatically - you don't have to add any events to track it.


Oct 17, 2011 at 4:45 PM

Thanks for the reply.

I'm a bit confused about the CurrentScreenChanged event, I can't seem to find anything about it in the docs. Is this event directly tied in to the phone's Navigation Service.

If so then my app presents a special case as (due to a UE decision which was not in favour) our application does not use the Navigation Service, rather it moves to a new page by simply re-drawing the current page. This means I'm not firing any OnNavigatedTo events, if these are related to CurrentScreenChanged.

Is there a way to fake this or trigger the CurrentScreenChanged event manually?




Oct 17, 2011 at 4:56 PM


I tested this by using a call to NavigationService.Navigate and the page tracking worked as expected. So it seems to be due to my app's design. I therefore need to trigger the event call manually.

Nov 25, 2011 at 8:56 AM


I figured out how to do this manually by just dipping into the source code. A Page View is just a specific set of AnalyticsEvent property values sent so all I'm calling is.

Log(new AnalyticsEvent() {
ActionValue = pageViewUri,
HitType = Microsoft.WebAnalytics.Data.HitType.PageView,
Name = "CurrentScreenChanged",
NavigationState = pageViewUri,
ObjectType = pageViewUri

Which is working how I want it. 

Please feel free to close this issue.

Jan 5, 2016 at 7:06 AM