Hi,

I had some problems with this, particularly with Internet Explorer - here is my code that worked, although someone complained about errors in IE7 or 8 about _gat being undefined - I guess you can hide these with a try / catch block, but then it would be nice to know how to fix because people still insist on using IE...:

JavaScript

<script type="text/javascript">
       // <![CDATA[
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">
       // <![CDATA[
       var pageTracker = _gat._getTracker("UA-#######");
       pageTracker._initData();
       pageTracker._trackPageview();
function trackTesting(page) {
           pageTracker._trackPageview(page);
       }
       // ]]>
   </script>


ActionScript

       var page:String = evt.type.substr(5);
       sendToURL(new URLRequest("javascript:trackTesting('"+page+"');"));
       trace("eventHandler for type " + evt.type + " from " + evt.target);

John R. Sweeney Jr wrote:
Howdy all,

Hope everyone had a great holiday.

My client wanted me to incorporate Google Analytics - Event tracking. Based
on what they supplied me and what I've read on GA, I've incorporated these
calls through out my program:
---
GetURL("javascript:pageTracker._trackEvent('Videos', 'Play', 'Gone With the
Wind');");
---


Then in my index.html I used the GA supplied code (below is the generic
equivalent):
---
<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-xxxxxx-x");
pageTracker._trackPageview();
} catch(err) {}</script>
---

I'm not getting the events recorded at GA. I've read that an alternative is
to change (in the html) pageTracker._trackPageview(); to
pageTracker._trackEvent();, but still no luck.

Does anyone have any experience with this and can make a suggestion. I know
that the calls inside the Flash app are all working (I've tested with a
visible text field on the app to verify content), so I'm assuming the
problem is in the html/javascript sniptet call to GA, but I'm not sure.

Any help would be greatly appreciated.


Thanks in advance,
John




John R. Sweeney Jr.
Interactive Multimedia Developer


OnDemand Interactive Inc
945 Washington Blvd.
Hoffman Estates, IL 60169
Office/Fax: 847.310.5959
Cellular: 847.651.4469
www.ondemandinteractive.com


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


--

Glen Pike
01326 218440
www.glenpike.co.uk <http://www.glenpike.co.uk>

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to