Tracking Flash / Flex / AIR applications with Google Analytics

In case you weren’t aware, a lot of the stuff you can do in a website you can also do in the Flash Player.  Prime example: Google Analytics tracking.

Now for a simple Flash movie, you’d traditionally host the Flash file in an external website, and add the tracking to the HTML pages.  If you’re doing something a little more different – or are obsessive about knowing how your users are interacting with the content – you might be interested to know that there is support for actionscript-initiated tracking, and that it’s supported by Google themselves (a good sign).

You can read all about the Google Analytics tracking component for Flash on the Google code website: http://code.google.com/apis/analytics/docs/tracking/flashTrackingIntro.html

Where this really comes into its own is in AIR applications.  Flash / Flex tracking in a HTML website isn’t really all that special – once you know the API a little, you can always use the ExternalInterface commands in the Flash Player to communicate with javascript functions on the host page, but that kind of option isn’t usually available to a pure Flash-based AIR application.  Using the component effectively removes the need for the external javascript file, and means that your desktop AIR application can communicate freely with Google Analytics – enabling application tracking.  The code is no different whether its an online Flash webpage, or a desktop AIR application.

, , , ,

About James

James is a Senior New Media Developer at MMT Digital, and has BA(Hons) in Design for Interactive Media from the University of Gloucestershire. He loves designing and producing all sorts of website and Flash-related things, as well as prattling on about technologies.Day-to-day he works with Flash, Dreamweaver, Director, Microsoft Office Sharepoint Server 2007 (MOSS) and in his spare time he mucks about in Flex and Wordpress.Follow James on Twitter.

7 Responses to “Tracking Flash / Flex / AIR applications with Google Analytics”

  1. venkat 25th June, 2009 at 1:51 am # Reply

    GA tracking is not supported for AIR applications. There is a note on the page that says.

    “Note: Currently, Flash tracking is available for any Flash content embedded in a web page. Tracking of data sent from Adobe Air, Shockwave, or via the Flash IDE (e.g. using Test Movie) is not supported at this time.”

  2. James 25th June, 2009 at 8:18 am # Reply

    @venkat – That may be so, but speaking from experience, it does actually still work.

    I’m working on a more in-depth ‘how to’ post, so stay tuned…

  3. Luis Tello 28th July, 2009 at 6:29 pm # Reply

    What did you use as a URL when you signed up GA. Did you use a proxy URL and then sent all your data over to it as it occurred on the Air App?

  4. James 28th July, 2009 at 7:46 pm # Reply

    I actually used just the url of this website (http://www.psyked.co.uk/) – it seems the URL is just used for validating the account – and there’s no problems with the tracking.

  5. Luis Tello 28th July, 2009 at 8:45 pm # Reply

    Hey James, We got the account and pulled Google’s code from ga.js and put it locally. We need to wait till 3:50pm EST, but are we missing anything else?

  6. alchemist 9th September, 2009 at 12:40 pm # Reply

    Here’s a more detail example of Flex and Google Analytics hope it helps

    http://bytearray.brixtonjunkies.com/2009/08/20/flex-google-analytics-howto/

  7. Paul Sanderson 16th September, 2009 at 1:51 pm # Reply

    Hey guys if you want to track an Air Application you should look at http://www.airanalytics.net.

    We can tell you how many installs you have had, the number of uses etc… we can even keep tracking when your app is offline….

    Air Analytics currently in private beta but we are looking for people to test out our system. So if you register I will activate you and you can have a bash with our system.

    Thanks Paul

Leave a Reply

Note: This post is over 2 years old. You may want to check later in this blog to see if there is new information relevant to your comment.