Posts Tagged Google Analytics for Flash

Prepare to Roar

If you have been wondering why I haven’t been writting a lot this summer, well it’s been mostly because of this project. I learned a great deal on Papervision3D, using the webcam, on playing with bitmaps and on Facebook connect (even if I wasn’t the one doing that part) while building this project. So here you go, create some roars:

http://www.roar4milk.ca

The goal of the campaign was to get teens involved with milk and to build on some ad spots that performed very well on MTV. So what you are doing with this application is recreating the ads but adding yourself at the end instead of the cow. Now I knowthat the site is a bit (to say the least) CPU intensive (3D tends to do this), but believe me it was worse than this before and I wish I would have had a bit more time to perfect this site.

The technical cool part is that you can use your picture, be it by uploading it or using your webcam, and using the derivate bitmap I will composite it with the cow skin and apply that to the loaded Collada model. That was kind of the premise of this site and we built around it with a vintage design. I hope you like it.

Here is a short list of librairies we used: as3corelib, TweenLite, Alcon, facebook api, google analytics for flash and Papervision3D.

Another cool feature is that you can embed your roar on your blog like this:

, , , , , , ,

No Comments


Why I have been talking so much about Google Analytics lately

If you take a look at my 4-5 last post you’ll notice that they are all about Google Analytics, be it Google Analytics for Flash or Google Analytics Data API. There are a couple of good reasons for that.

A new presentation

First, I’m really proud (and scared) to say that I am going to give a presentation at the InsideRIA conference in August in San Jose. The topic will be Google Analytics For Flash so I’m mostly going to reuse my presentation I did for the Montreal Flash User Group but I will adapt it for RIAs and I will add a big part on how to retrieve the data you send to Google back in your RIA using Google Analytics Data API. So I need to shape up on those topics and learn every thing there is to learn so that I can give a presentation with great content.

A new application

Secondly, I have this great idea. I wasn’t going to blog about it at first until it was done but my motivation kinda withered so I hope that by exposing it here and getting feedback I will start working on it again. What I want to do is build a rich internet application that displays Google Analytics Data in a way that makes more sense for Flash website. Flash website differs from HTML website in a lot of ways but web analytics don’t display their data while taking these differences into consideration. If we only take preloading and videos, we could have insightful data visualization that would show how many people saw which section of your video (that could be a heat map representing the timeline of the video) or how many people started the preloading process but didn’t end it. Another area that I would like to tackle is to set a standard on how to use events.

Right now there is no clear guideline on how to use events. It’s really free for all and no one is doing the same thing, so when you go in someone else reports it takes a while to understand what is going on. So I would basically be creating a set of guidelines for Events and then my application would be interpreting them differently than Google Analytics. While I’m there I could also associate events with pageviews. What is disturbing right now is that with events you can know how many people clicked on your button but it is pretty hard to see how many people actually saw the button so it’s hard to tell if your interface is performing well.

Well that my plan, the first step was to be able to connect to Google Analytics Data API using Flash on a webserver which I found out how. Now what I have left to do is create the guidelines for events and the interpret the data from Google Analytics. If you got any feedback on my idea please put it in the comments; it would really motivate me to start working on it.

, , , ,

1 Comment


My Google Analytics For Flash presentation slides

Last Thursday I did my presentation on Google Analytics for Flash for SWFMontreal and it went really well. I learned 2 things while doing it. First that I should practice presenting out loud before doing my real presentation because it just better than practicing in my head. Secondly that a bomb threat in the Montreal metro can really decimate the audience. As a matter of fact, since there was the previously mentioned threat, the attendance to the user group was greatly reduced (15 people instead of 50). That was sad, but there was nothing I could do. I still wanted to post my slides so here they are.

On the same note, I received my copy of the Flash & Flex developer’s magazine where my article on Google Analytics For Flash was published and it feels very nice to see my own work in paper. They forgot to put my bio where I mention this blog, but I think they will fix this on my next article on TubeLoc. Can’t wait to see it.

Here is the verbatim from my slides

Google Analytics For Flash – Presentation Transcript

1. Google Analytics for Flash
2. Dominic Gélineau Flash developer Analytics, Animation, SEO dgelineau@gmail.com Blog: www.zedia.net Twitter: http://www.twitter.com/zedia WE ARE HIRING aubrey@twistimage.com
3. Why care about analytics? Because it’s cool To provide data to your clients on the impact of what you are doing To give you feedback on the effectivness of your work
4. Why Google Analytics? It’s free It’s widely used It has a concept called event It now has a library just for Flash
5. Basic concepts about web analytics PageViews Events
6. PageViews The PageViews model is based on the HTML version of a web page The real idea behind a pageView is NAVIGATION In HTML this is sent automaticaly every time the user changes or refresh the pageIn Flash we have to do this manually We should try and keep the same syntax as HTML for consistency
7. Events The real idea behind events is INTERACTION Whenever you want to track something that is not related to navigation you should use an event. In Google Analytics Events are not enabled for all profiles http://code.google.com/p/gaforflash/wiki/EventTrackingRequ est
8. Google Analytics for Flash Library http://code.google.com/p/gaforflash/ Just search Google for «Google Analytics for Flash»
9. How to install it Flex and Flash CS4 can import SWC Flash CS3 can’t Download the library from SVN Put the SWC file in this folder: C:\\Program Files\\Adobe\\Adobe Flash CS3\\language\\Configuration\\Components Macintosh HD:Applications:Adobe Flash CS3:Configuration:Components
10. Sample Code import com.google.analytics.AnalyticsTracker; import com.google.analytics.GATracker; var _tracker:AnalyticsTracker = new GATracker ( main, “UA-7777777-7”, “AS3”); _tracker.trackPageview(yourSectionName + “/”);
11. More on Events _tracker.trackEvent(“English”, “Client Quiz”, “Question 3”, value); Category, Action, Label, valueOnly the two first are mandatory Value is an integer No standards, no real guidelines
12. 2 Modes: AS3 vs Bridge The library can work in two modes, AS3 or Bridge. Each of them has there advantages.
13. AS3 Mode Stand Alone mode Doesn’t require javascript Usefull for full Flash website Usefull when you don’t control the HTML that wraps the swf like for widgets or games
14. Bridge Mode var _tracker:AnalyticsTracker = new GATracker (main, “window.PageTracker”, “Bridge”); Integrates better when the Flash part of a website is minor Enables more of the Google Analytics API like E-commerce allowScriptAccess = always
15. Visual Debug var _tracker:AnalyticsTracker = new GATracker (main, “UA-7777777-7”, “AS3”, true);   One of the coolest features of GA for Flash Permits you to see in real time what is being sent to Google Clear advantage over the old way, which was to wait 3 hours and check to see if everything worked
16. Visual Debug Screenshot
17. What should you track Too much is like not enough Tracking errors is really helpful
18. One draw back The library will add 40k to your project Might not be the best thing for all project Like banners
19. Links  Google Code – http://code.google.com/p/gaforflash/  Developer group – http://groups.google.com/group/ga-for- flash?pli= 1  Adobe Max presentation on GA for Flash – http://tv.adobe.com/#vi+f15385v1040
20. Questions?
21. Thank you Dominic Gélineau dgelineau@gmail.com www.zedia.net http://www.twitter.com/zedia

, , ,

2 Comments


Using Google Analytics for Flash in conjunction with PureMVC

I have been playing lately with Google Analytics for Flash and since my previous attention span (I noticed than I tend to write a lot on a topic until I find something else that interest me a lot, now is Google Analytics’ turn)  was spent on PureMVC, I thought it would be good too write a post about using the two of them together.

It is actually very easy to integrate them. All you have to do is dedicate a Proxy to Google Analytics. First go download Google Analytics for Flash (I’ll write a post later on how to import it because I found several ways). From there just create a Proxy for it like this:

package com.zedia.model{
  import flash.display.DisplayObject;
  import org.puremvc.as3.interfaces.IProxy;
  import org.puremvc.as3.patterns.proxy.Proxy;
 
  import com.google.analytics.AnalyticsTracker;
  import com.google.analytics.GATracker;
 
  public class GoogleAnalyticsProxy extends Proxy implements IProxy{
    public static const NAME:String = "GoogleAnalyticsProxy";
 
    private var _tracker:AnalyticsTracker;
 
    public function GoogleAnalyticsProxy(main:DisplayObject){
      super(NAME);
 
      _tracker = new GATracker( main, "UA-639032-8", "AS3", false );
      _tracker.trackPageview();
    }
 
    public function trackAction(action:String):void {
      _tracker.trackEvent( "my category", action);
    }
 
    public function trackLabel(action:String, label:String):void {
      _tracker.trackEvent( "my category", action, label);
    }
  }
}

What is cool with this Proxy is that it is tied with nothing, you can just go and use it in any project and all you have to do is change the package name. Also notice that for the category argument of the trackAction and trackLabel method I used the “my category” String. I live in Montreal in Canada and we have here two official languages: French and English. I have found that putting the language as a category was a good habit, but I think it is not the case for every one, so I left it as a generic String in this example.

The next thing you have to do is to register this Proxy. The best place to do so is in the Startup Command. You do so this way:

facade.registerProxy(new GoogleAnalyticsProxy(Object(note.getBody()).main as Main));

Google Analytics for Flash require a DisplayObject as his first parameter and the Startup command usually needs a reference to the Stage to pass to the ApplicationMediator. In this case the main in the notification will serve me both as a link to the Stage and as a DisplayObject.

Now we are all set, we can call upon this Proxy from anywhere in our PureMVC application. I would suggest making a Command for just that. Here is the code you would put in your Command:

//retireve the Proxy
var googleTracker:GoogleAnalyticsProxy = facade.retrieveProxy (GoogleAnalyticsProxy.NAME) as GoogleAnalyticsProxy;
 
//Use tracking with just an Action
googleTracker.trackAction("Send to Friend");
 
//Use tracking with Action and Label
googleTracker.trackLabel("Error", "Send to Friend - Incomplete form");

Well it is that easy to integrate Google Analytics for Flash with PureMVC.

, ,

5 Comments


More about Google Analytics for Flash

I know I have been bad mouthing (see comments) a bit on Google Analytics for Flash, but it is mostly because I expect great things from that library and I have been wanting it for a long time. Last week I have been playing around with the API and there is a couple of findings I wanted to share with you.

First off, the library only works for Actionscript 3, which is not a big concern to me because I hope I will only be doing Actionscript 3 projects from now on. Also, when you include the library (at least in AS3 mode, haven’t tested in bridge mode) it will add about 40k to your file size. This is not so bad, but not so good at the same time. Making this smaller could make it accessible for a broader range of projects. Also I tried to import both the SWC you find on the download from Google code, but none of them would work; Flash would complain about not being able to import them. I finally circumvented that problem by checking out the source code using SVN.

Once you’re set up, one off the coolest things you can do is set the tracker to debug mode; it gives you some insights about what is going on under the hood. But for those of you who don’t want to go through all that trouble I just posted it down here:

Here is the Actionscript 3 code I used to make my test:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import com.google.analytics.AnalyticsTracker;
import com.google.analytics.GATracker;
 
var tracker:AnalyticsTracker;
 
tracker = new GATracker( this, "UA-639032-8", "AS3", true );
 
button1.buttonMode = true;
button2.buttonMode = true;
 
button1.addEventListener(MouseEvent.MOUSE_DOWN, _onBut1Down, false, 0, true);
button2.addEventListener(MouseEvent.MOUSE_DOWN, _onBut2Down, false, 0, true);
 
function _onBut1Down(event:MouseEvent):void{
	tracker.trackPageview("/test1");
}
 
function _onBut2Down(event:MouseEvent):void{
	tracker.trackEvent( "say", "hello world", "test", 123 );
}

In this code, the fourth parameter in the constructor of the GATracker object is the debug parameters, setting it to true will enable this view.

My main goal for making this was because I had read that in AS3 mode you could track events yet (check in the comments). So I created a new profile in my GA account for testing purpose and set all this up, but the major problem was that not all profile get event tracking activated.  Actually, I have written a post about event tracking being out, but my guess is that Google is extending the beta (Google sure does love betas) to more accounts and that mine was one of them. But even if your account has been activated for event tracking, newly created profiles won’t be activated.

So I had some test running but no way to check the results. That was true until I found this hidden gem (I am probably shooting myself in the foot right now and should keep this a secret but hey!) in the midst of the Google code website for Google Analytics for Flash : A request form to activate event tracking on certain profile of a Google Analytics account. I did so, and three days later I could see the results of my tests. Event tracking was working just fine in AS3 mode. The form says that they will accept 500 requests so you better get profiles activated if you plan on using it. But even if your account is not activated Google will still record the events; it’s just that you won’t be able to see the results until it is activated. We have some projects that fall in that category; mostly the Twist Image Holiday card : It’s a wonderful life (shameless plug). We hope event tracking gets out of beta really soon!

Well that’s about it, see you tomorrow as I try to complete this week of post every day.

, , , , ,

2 Comments



Parse error: syntax error, unexpected ';' in /homepages/25/d169645162/htdocs/wp-content/themes/fusion/footer.php on line 13