|
Note: This article is for the latest version of the tracking code. If you are using the older version, please read the following article.
To determine which tracking code you are using, please see Which version of the tracking code am I using? |
Google Analytics lets you track any browser based event, including Flash and JavaScript events. Below are two ways you can do this. Please expand the plus box to see the code for the two ways.
I. Use the _trackPageview function
You can assign a page filename to any Flash action with this function, 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.
- 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.
Click to view Flash code examples
II. Google Analytics for Adobe Flash
Another more advanced option for tracking Flash is to take advantage of Google Analytics' partnership with Adobe Systems, Inc. in an open source initiative for tracking Adobe Flash. The Google Analytics for Adobe Flash component simplifies tracking your Flash content and better handles DOM access. It is useful for a number of common tracking purposes in Flash, such as:
- an embedded Flash widget on an HTML page
- a standalone Flex application or Flash-only site hosted on an HTML page
- a distributed Flex/Flash game or program where the developer has no control over where the widget will be placed.
The software for Google Analytics for Adobe Flash is developed under an open source initiative with Adobe Systems, Inc. If you are a developer interested in contributing to the project, visit the project home page at http://code.google.com/p/gaforflash/.