[Flashcoders] Problem with trackEvents in Flash
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-xx-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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Problem with trackEvents in Flash
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-xx-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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Problem with trackEvents in Flash
I'll try a variant of this (this is written in AS2), but the first problem I had was the catch that wrapped the pageView. On the PC side, it would change the html page (which held my app) to a blank page with the word TRUE and the URL was my trackEvent string. That is what started me on this quest. Maybe someone else had this too. Thanks for the suggestion, John on 12/28/09 10:08 AM, Glen Pike at postmas...@glenpike.co.uk wrote: 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...: 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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Problem with trackEvents in Flash
Cool. Just checking. Since you had everything else URL encoded, I thought it might be getting cut off because of that space. Not completeing the full string. GL Karl Sent from losPhone On Dec 28, 2009, at 3:59 PM, John R. Sweeney Jr jr.swee...@comcast.net wrote: Thanks, but I just copied this snipet from the web. My code had the registry number and domain, so I just used this example from GA. Thanks anyway, John on 12/28/09 3:23 PM, Karl DeSaulniers at k...@designdrumm.com wrote: I am not sure if this is the issue, but did you mean to not URL encode the space in this line? %3Cscript src= 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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Problem with trackEvents in Flash
don't forget to check this: http://code.google.com/p/gaforflash/ []'s andrei http://code.google.com/p/gaforflash/ On Mon, Dec 28, 2009 at 8:13 PM, Karl DeSaulniers k...@designdrumm.comwrote: Cool. Just checking. Since you had everything else URL encoded, I thought it might be getting cut off because of that space. Not completeing the full string. GL Karl Sent from losPhone On Dec 28, 2009, at 3:59 PM, John R. Sweeney Jr jr.swee...@comcast.net wrote: Thanks, but I just copied this snipet from the web. My code had the registry number and domain, so I just used this example from GA. Thanks anyway, John on 12/28/09 3:23 PM, Karl DeSaulniers at k...@designdrumm.com wrote: I am not sure if this is the issue, but did you mean to not URL encode the space in this line? %3Cscript src= 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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders