<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-xxxxxxx-x");
pageTracker._trackPageview();
} catch(err) {}
</script>
I use it on my site directly from within flex. (not flexviewer though)If you are not putting it into your index.template.html that where are you putting it?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
minWidth="955" minHeight="600"
addedToStage="onComplete()">
<mx:Script>
<![CDATA[
import com.google.analytics.GATracker;
import com.google.analytics.AnalyticsTracker;
public var tracker:AnalyticsTracker;
private function onComplete():void
{
tracker = new GATracker( this, "UA-111-222", "AS3", false );
tracker.trackPageview( "/Initial");
}
protected function b1_clickHandler(event:MouseEvent):void
{
tracker.trackPageview( "/Widget1_load");
}
protected function b2_clickHandler(event:MouseEvent):void
{
tracker.trackPageview( "/Widget1_table");
}
protected function b3_clickHandler(event:MouseEvent):void
{
tracker.trackPageview( "/Widget2_load");
}
]]>
</mx:Script>
<mx:Panel id="p1">
<mx:Button id="W1_load" click="b1_clickHandler(event)"/>
<mx:Button id="W1_table" click="b2_clickHandler(event)"/>
<mx:Button id="W2_load" click="b3_clickHandler(event)"/>
</mx:Panel>
</mx:Application>