GoogleAnalytics Behavior not droppable on my LayoutRoot

Oct 27, 2010 at 3:23 PM
Edited Oct 27, 2010 at 3:43 PM

I am trying to add GA to my SL4 web site project in Blen 4;  I had no trouble dragging the TrackAction to the frame element.  However, when I try to drag the GoogleAnalytics behavior to my LayoutRoot Blend indicates "Not a valid target".  My workaround is to add a reference to 'Google.Webanalytics' and the following directly into the XAML of the navigation page:




        <gwa:GoogleAnalytics WebPropertyId="UA-*********"/>



Is this a Blend bug or is there an issue using a ScrollViewer as the LayoutRoot element with Google?


Sorry, I hit the save too soon.

The issue that I ran into after manually adding the Google behavior is that at runtime the GA behavior throws an exception of "Add value to collection of type 'System.Windows.Interactivity.BehaviorCollection' threw an exception. [Line: 26 Position: 44]"

Oct 27, 2010 at 5:12 PM

GoogleAnalytics is a behavior for Panels (because it adds a hidden image) so it must go on Panel-derived class (like Grid or StackPanel).

For you the easiest thing to do is wrap your ScrollViewer in a Grid.


Oct 27, 2010 at 5:50 PM



Thanks - That was the issue; You might consider adding a note to that effect on the "Getting started" page of the documentation.  The closest that I found is on the "Architecture" page where it kind of implies that the LayoutRoot is a grid but doesn't really say that any Panel class will do.