1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

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.

7 Comments »

  1. 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.”

    Comment by venkat — 25 June 2009 #

  2. @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…

    Comment by James — 25 June 2009 #

  3. 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?

    Comment by Luis Tello — 28 July 2009 #

  4. 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.

    Comment by James — 28 July 2009 #

  5. 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?

    Comment by Luis Tello — 28 July 2009 #

  6. 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/

    Comment by alchemist — 9 September 2009 #

  7. 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

    Comment by Paul Sanderson — 16 September 2009 #

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

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