Getting Error in Adding Google Analytics in Silverlight

Jul 19, 2011 at 1:34 PM

Hi All,

I am trying to integrate Google Analytics into my silver light out of browser application. I am using Blend 4, VS 2010 and MSAF 1.4.10

I have include the following code in my App.xaml

    <Application  
      x:Class="SilverlightApp.slate.App"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:mwa="clr-namespace:Microsoft.WebAnalytics;assembly=Microsoft.WebAnalytics"
                 xmlns:ga="clr-namespace:Google.WebAnalytics;assembly=Google.WebAnalytics">
   
   
        <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="Assets/Styles.xaml"/>
                    <ResourceDictionary Source="CustomControls.xaml"/>
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
   
        </Application.Resources>
   
        <Application.ApplicationLifetimeObjects>
            <mwa:WebAnalyticsService>
                <mwa:WebAnalyticsService.Services>
                    <ga:GoogleAnalytics WebPropertyId="XXXXXXXXXXXXX" />
                </mwa:WebAnalyticsService.Services>
            </mwa:WebAnalyticsService>
        </Application.ApplicationLifetimeObjects>
    </Application>

In the Main Page.XAML under the Grid i have added this code:

<Button x:Name="btn_library_Icon" Margin="86,2,64,6" Style="{StaticResource menu_librarybuttonstyle}" FontFamily="/SilverlightApp.slate;component/Fonts/Fonts.zip#Segoe UI" FontSize="9.333" Click="btn_library_Icon_Click">
                    <i:Interaction.Triggers>
                        <i:EventTrigger SourceName="btn_library_Icon" EventName="Click">
                            <mwab:TrackAction Category="Library Accessed"/>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                    <Image x:Name="image" Source="Assets/icon_menu_library.png" Stretch="Fill" Width="23" Height="23"/>
               </Button>

when i run this it gives me an error as :
Add value to collection of type 'System.Windows.Interactivity.TriggerCollection' threw an exception.

Am i Missing something here?

Please guide me in this.

Regards
Biju S Melayil