Flex and Google Analytics - Event Tracking Mystery and How To Track Events In Child Components

I've begun to start using the Google Analytics Tracking for Adobe Flash for the Adobe Flex at work. The early results have been promising, and the first wave of deployment happened last week. We re-released several applications to start tracking an important key performance indicator, new customer signups.

Getting started and using the analytics.swc is not that bad. And there is a good intro video at Adobe.tv on the integration of Google Tracking and Flex. Also, there is a recent, as of this writing, article at InsideRIA on Google Analytics within Flex/Flash Applications.

Using the Google component is relatively straightforward, but I have encountered a couple of snags. The first is Event Tracking, as opposed to Page Tracking, and the other is the required location of the <ga4flash:FlexTracker> object.

Event Tracking

Instead of mapping your Flex application events to page views, Event Tracking allows you, somehow, to record a more detailed event. The downside is that I have no idea how to get this going. Adding the code is easy enough (I can copy-and-paste like you can't believe if I must), but I have not been able to figure out where to pick up the payload. That is, there is no Events area in my Google Analytics account. I've seen screen captures of where it ought to be, but not so much when I log in. Further, Google's documentation on this has been ... well ... sparse.

In the InsideRIA article, there is this lovely aside: Note that any GA profile can receive pageview tracking from the gaforflash API (unlike Event Tracking which requires that your profile be white-listed by Google before you can see the data). (I added the bold)

Still spelunking through Google docs and SERPs for how to digest that little nugget. Of course, my searching has been somewhat manic as I have had to integrate the tracking and redeploy the apps on an express timeline (actually, all of my tasks exist in an express timeline that is a LIFO job stack - though sometimes I'll dig into the stack to pick off some low hanging fruit). Expect me to post again once i get past this little hassle. In the meantime, we are working around this by using the following for our trackPageview target:

"/myPseudoPath/targetFileName.ext?name1=value&name2=value2&nameN=valueN"

This went live on Friday, so I will have real data to peruse shortly and will likely followup to this post with results.

Where to put <ga4flash:FlexTracker>

All the examples of Flex with Google tracking are nice and simple. And that is great; One of my biggest pet peeves about the CF8 documentation, for example, is some of the overly complicated examples that make it difficult to see what is going on at a glance. Of course, the downside to simple examples as real applications can get to be way more interesting.

As I mentioned above, in the apps I redeployed, we are tracking new customer signups. There are several applications on the site that require you to be a registered user. For marketing purposes, we don't throw a wall up at the very beginning and say, "you have to login first". Instead, we try to provide as much value as possible, and let the user engage the application as much as possible before asking them to login and signup. To be quite frank, we want to convert at this step at as a high a rate as possible and the longer they work with the app the more invested they will become. Towards that end, the Flex app handles the signup as well; We don't want the user have to change pages. Of course, if the customer is already logged in, we know that because our Flex app is aware of the Coldfusion session and we won't bother them with a login request.

So, at the appropriate time, we spawn a new TitleWindow based object and ask the customer to login. If they are not already registered, no worries, we spawn another TitleWindow based object that presents a short form. Creating login and signup components is a good thing as it allows for reuse of a very common feature. [in this case, it can be bad as it was one of my earlier Flex components and everytime I have to work with it I really want to get in there and overhaul it - but it works and there is a backlog of projects, so I have to keep using it] Ok, so I am regressing to my Short-Story-Long Pattern.

This is all worth mentioning as the target behavior to track is in the last TitleWindow. So, you'd think that I would use the <ga4flash:FlexTracker>, however, again, not so much. I've found that the Google analytics.swc component has to be placed in the MXML document containing the <mx:Application> or it won't work. In my case, that meant creating an eventListening chain so that a handler in the base page could make the trackPageview() call. This isn't so bad and I have even already blogged on how to communicate between components in Flex.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.001. Contact Blog Owner