| How do I track Flash events? |
|
Google Analytics lets you track any browser based event, including Flash and JavaScript events by using the _trackPageview function, you can assign a page filename to any Flash action, and enter that filename into the appropriate goal or funnel step. Important: Please note that your analytics tracking code and calls to _gat._getTracker must be placed on the page above the call to _trackPageview. <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"> var pageTracker = _gat._getTracker("UA-xxxxxx-x"); pageTracker._trackPageview(); </script> To track an event, call _trackPageview() with an argument specifying a name for the event. For example, calling: pageTracker._trackPageview("/purchase_funnel/page1.html"); will cause each occurrence of the the calling Flash event to be logged as though it were a pageview under the name /purchase_funnel/page1.html . The argument must begin with a forward slash and be in quotes. The event names may be organized into any directory style structure you wish. The path/filename argument to _trackPageview need not represent an actual URL on your website. Flash Code Examples on (release) { // Track with no action getURL("javascript:pageTracker._trackPageview('/folder/file.html');"); } on (release) { //Track with action getURL("javascript:pageTracker._trackPageview('/folder/file.html');"); _root.gotoAndPlay(3); myVar = "Flash Track Test"; } onClipEvent (enterFrame) { getURL("javascript:pageTracker._trackPageview('/folder/file.html');"); } To verify that _trackPageview is being called correctly, you can check your Top Content report 24-48 hours after the updated tracking code has been executed. You should be able to see the assigned pagename in your report. Source: Google Analytics Help |