MSAF - Google Analytics for WPF. Search for working demo

Dec 6, 2011 at 8:35 AM

Hello! I am currently using MSAF to track user activity in Windows Phone 7 projects and i really like it. Now i want to do the same in my WPF applications. Unfortunately i could not find ANY working demo project across the Internet. I tried do use drag'n'drop method in Expression Blend 4, but when i run my project it throws an Exception. I am becomming this exception on adding Google analytics behavior to Interaction.Behaviors (VisitorID property not found). Could somebody write a small tutorial how to get it working? Thanks!

Here is my XAML:

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
				xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
				xmlns:mwab="clr-namespace:Microsoft.WebAnalytics.Behaviors;assembly=Microsoft.WebAnalytics.Behaviors.WPF"
				xmlns:ga="clr-namespace:Google.WebAnalytics;assembly=Google.WebAnalytics.WPF">
    <Grid x:Name="LayoutRoot">
			<i:Interaction.Behaviors>
				<ga:GoogleAnalytics WebPropertyId="UA-123456-78" SessionLength="30" />
			</i:Interaction.Behaviors>
		<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="25,12,0,0" Name="button1" VerticalAlignment="Top" Width="75" >
			<i:Interaction.Triggers>
				<i:EventTrigger EventName="Click">
					<mwab:TrackAction/>
				</i:EventTrigger>
			</i:Interaction.Triggers>
		</Button>
	</Grid>
</Window>

 

Jan 15, 2012 at 10:59 PM

Hi apic, did you find a solution? I'm considering this too.

Thanks.

Jan 16, 2012 at 6:15 PM

Hi dadvir, unfortunately i didn't find the solution yet. It seems, that the WPF Version of analytics framework was compiled with wrong settings (or setting names). Anyway, i desided to use GaDotNet library (can be found on Codeplex). It is simple and powerful library which can track not only events, but pageviews and transactions too (very useful to track in realtime). The only disadvantage of this project is that you have no drag_'n' drop visual elements in it. That meens that you must implement tracking in code. But it is very simple. Try it out if you have no time to wait for an update... 

May 10, 2012 at 12:16 PM

I guess I'll look at Ga.Net (now on github). Thanks for the advice. I wish they would have actually written a demo app using the behaviors. Disappointing.

Jan 5 at 6:05 AM