Add services in App not working

May 17, 2010 at 6:47 PM

Did i misunderstand the Getting started -> Adding Analytics Tracking to a Silverlight Application help.

    <Application.ApplicationLifetimeObjects>
        <mwa:WebAnalyticsService>
            <mwa:WebAnalyticsService.Services>
                <ga:GoogleAnalytics WebPropertyId="UA-****-1"/>
            </mwa:WebAnalyticsService.Services>
        </mwa:WebAnalyticsService>
    </Application.ApplicationLifetimeObjects>

I understand that this should work: but it is not working. I must also add it in MainPage (where frame control is)

		<i:Interaction.Behaviors>
			<ga:GoogleAnalytics WebPropertyId="UA-****-1"/>
		</i:Interaction.Behaviors>

I though that i can set only in App.xaml and the it will be visible everywhere.

My MainPage.xaml

<sdk:Frame x:Name="frame" UriMapper="{StaticResource urimapperMain}" Source="/Domov" BorderThickness="0" >
					<i:Interaction.Triggers>
						<i:EventTrigger EventName="Navigated">
							<mwab:TrackAction/>
						</i:EventTrigger>
					</i:Interaction.Triggers>

 

May 17, 2010 at 6:57 PM

Maybe because i am getting silent error in browser:

Unhandled Error in Silverlight Application Object reference not set to an instance of an object. at System.Windows.Interactivity.Interaction.GetBehaviors(DependencyObject obj) at Microsoft.WebAnalytics.WebAnalyticsService.AttachServices(DependencyObject layoutRoot) at Microsoft.WebAnalytics.WebAnalyticsService.AttachServices() at Microsoft.WebAnalytics.WebAnalyticsService.Started() at System.Windows.Application.Application_Started(Object sender, EventArgs e)

The error is causing:
<ga:GoogleAnalytics WebPropertyId="UA-****-2"/>
this line. If i remove it, there is no error.

What to do now?