Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Why Google Analytics for Flash

DZone's Guide to

Why Google Analytics for Flash

· Web Dev Zone
Free Resource

Should you build your own web experimentation solution? Download this whitepaper by Optimizely to find out.

Since I was involved in the initial development, I’ll attempt to give some context as to why you’d want to utilize Google Analytics for Flash. A lot of people have a need for metrics of their Flash files. Originally, the only way to track things in Flash was to create your own back-end solution. For a lot of people, this was a ton of work and/or beyond their capability. So, they had no clue who was seeing their content, and in what context (did someone host their SWF on another site, embed in a blog, launch from the desktop, etc.). All of these user metrics help drive how some people create content, and without those metrics, they cannot make educated decisions.

Then along came Mochi (not to be confused with MochiKit, the JavaScript library). It allowed you to easily track how your SWF was being viewed without no coding on your end. I don’t remember the GUI used to show those metrics, but bottom line, the metrics weren’t very fine grained, nor put into the context of an application.  At the time, though, no one knew any better, and it was great.  Mochiads has matured a lot today.

Every single software argument over design elements is all based on opinion. Until you do user testing, no one is technically “right” or “wrong”. For web applications, the poor man’s way of doing this is to implement Google Analytics. From this, you can determine how many times a user clicks on a button, how often they go to a certain section, how long they stay there, etc. This helps the designer make more educated designs (mostly) about their content. Users don’t seem to be using the help link. Why is that? Is it because they can’t see it (next to ads and thus banner blindness), because it’s small compared to the rest of the GUI buttons and out of the way, or perhaps the help content isn’t any good? While Google Analytics may not necessarily answer those questions, at least you start asking the right ones based on factual user metric data. While not a replacement for user testing, any testing is good.

Then along came the death of the page view as a metric. Once web applications started to get better metrics to measure them, we needed something similar for Flash. The problem was, Flash was even more advanced and interactive than a lot of the AJAX sites; we needed something more. We needed a simple way to create a hierarchy of user events we cared about, and needed a GUI capable of showing them.  Simple so even the existing agencies could easily integrate metrics, yet verbose enough so the Enterprise Flex apps could construe value from it as well.

Enter Google Analytics. It already had a great GUI for showing tons of metrics in a nice succinct format. Why not extend that for use in Flash applications? Combined with the Google Analytics team innovating, it was a great time to add a feature that allowed a more in-depth ability to create more than just a “page view” but an actual event with real meaning; meaning and context you pre-define, and code into your application whether during development or postmortem.

For example, at the time, I was working for an internet video company, and we were really curious how our users were using our various video players.  If you look on the web today, there are a lot of changes in video players.  Ever since Flash empowered you to create your own controls vs. being locked into what Real/Microsoft/Apple fed you, people have really innovated the video player concept.  While you could customize some of the players with your controls, even in Flash, can control the players via JavaScript, nothing comes close to the integration & responsiveness (*ahem* sometimes…) you get with Flash.  There are key points, chapter controls, ad dots, user comments,

This is also a problem, though.  With all of this innovation, you have absolutely no idea how a user uses your player.  I tried and failed to get budgets for user testing, so figured at the very least, I could track events with meaning.  Such as, “on the small skinned player, does the user ever press fullscreen” or “how often are they time-shifting the video”, and “how often are they using our menu”.  Most importantly, “how often does the video get to actually finish for progressive, or are they leaving mid-play?”  That last one is the kicker because clients would pay for what their users downloaded.  So if you only watch 20 seconds of a video, yet they download 2 minutes worth because of their fast connection, you still pay for the 2 minutes of bandwidth cost.  This is one facet to help in making better purchasing decisions on whether to switch to streaming video or not.

All of these questions and more really drove a lot of the design recommendations we gave clients and designed for.  Without having tested data, it made it challenging to really know if what we designed was right.

Now, design agencies have been using the traditional metric trackers for Flash sites for a long time.  The majority of which either use an fscommand or ExternalInterface call to JavaScript, which in turn sends the magic string on its way.  One key difference here is Google Analytics is free.

The main key difference, however, is the ability to create events.  An event is made up of categories, actions, labels, and an optional value.  So, instead of using the old page view tracker you can now go:

ga.trackEvent ( “BlueVideoPlayer”, “Play”, “Latest News 12.11.2008″);

and:

ga.trackEvent ( “MyWidget”, “Choose Song”, “DJ Fixx – Major Malfunction”, 128);

The blue video player had it’s playlist item clicked to see the latest news video for today.  The widget had the user choose a song, DJ Fixx‘ Major Malfunction at the 128 kb quality.  You’ll then have these organized for you with metrics attached in Google Analytics a day or so later.

With larger sized Flex projects, or even Flash ones, the need is clearly there.  How are people utilizing my embedded widget?  Is it used differently when embedded on different sites?  For consumer facing Flex apps, you can take this to the nth degree, and really track how your users are using your various components, and in what ways.  Since applications are dynamic, instead of tracking if a user ever actually goes to a screen, you can track how they interact with that page when there.

This in addition the data Google Analytics already gives you.

Hopefully you can start thinking of valuable insights you’d like to learn about your Flash content now that you have the ability to track the things you wish to track, WHEN you wish to track then, all with 1 line of code and some fore-thought into the events you’d like to track.

Original posting

Implementing an Experimentation Solution: Choosing whether to build or buy?

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}