Using Google Analytics with Adobe AIR install badg

Adobe AIR install Badge exampleIf you’re developing adobe AIR applications you might use the AIR install badge on your site to allow easy downloading of your application. So how can you integrate google Analytics to track how many times your application has been downloaded? It’s easier than you think…

These steps presume you’re already familiar with creating an adobe AIR install badge and google Analytics is already installed on your site.

Integrate google Analytics into your AIR install badge:

  1. make sure you have the latest Adobe AIR install badge files (download zip from Adobe site)
  2. Open the file “AIRInstallBadge.as”
  3. Add the ExternalInterface class somewhere under the other import statements (top of file)
    import flash.external.ExternalInterface;
    
  4. then find the method “handleActionClick” and add these lines as first lines within the function:
    // GoogleAnalytics script
    // change the gaLogAction value to the name you want to appear in the Analytics logs
    var gaLogAction:String = "/airbadge/"+action;
    var gaJS:String = "pageTracker._trackPageview";
    ExternalInterface.call(gaJS, gaLogAction);
    
  5. open the file “AIRInstallBadge.fla” to recompile your badge with the changes you just made
  6. upload the newly created AIRInstallBadge.swf to the same location on your site, overwriting the old AIRInstallBadge.swf
  7. test if the new clicks get registered in the Google Analytics site (this might take some time to show in the statistics, so be sure to check the next day as well)

…that’s all there is to it

If you want to see it in action, please check the ReviewR download page. It uses the same kind of patched install badge.

Some notes however:

  • this is the workflow for the newest Google Analytics script (ga.js, not the older urchin.js) you have to change the value in variable gaJS for the older script.
  • Your site should have Google Analytics installed already, if not please check out the Google Analytics site for more info.
  • And maybe an unnecessary note, but I make it nonetheless: the badge uses Actionscript 3.0 and at least Flash 9

Spring ActionScript 0.8 发布

Dear Community,

I’m pleased to announce that the Spring ActionScript 0.8 release is now available.

DownloadAPI DocumentationHTML DocsPDF DocsChangelog

This release includes the Spring ActionScript framework, the Cairngorm extensions and the PureMVC extensions.

All libraries are available for download at the following Maven repository: http://projects.yoolab.org/maven/content/repositories/

From now on, we will regularly publish new snapshots of the libraries there.

Direct links to the libraries:
- Spring ActionScript 0.8
- Spring ActionScript Cairngorm 0.8
- Spring ActionScript PureMVC 0.8

Dependencies:
- AS3Commons Lang
- AS3Commons Logging
- AS3Commons Reflect

Note: AS3Commons Lang is a snapshot of 1.0. We will work with a release for the following releases of Spring ActionScript

Besides a series of bugfixes, optimizations and improvements, some of the major changes and enhancements include:

Autowiring support

Using autowiring allows you to inject objects managed by the container into view components and other objects. To autowire a property, annotate it with the [Autowired] metadata tag. The support we build in is pretty enhanced and allows you to customize the autowire behavior in many different ways. Within the Autowired metadata tag you can specify the object name and you can also configure the container to filter autowire candidates using your own filter specifications. Please see the documentation on autowiring for more info.

Custom Namespaces

The XML configuration now supports namespaces and allows you to create custom namespaces yourself. A few namespaces have been added to simplify the configuration of common objects for RMI and Messaging. More info on available namespaces and schemas and creating custom ones can be found in the documentation. The XSD schemas are available http://www.springactionscript.org/schema/

MXML Configuration

We now also support configuration through MXML. The markup is very similar to the regular XML config, but with some slight differences. Please see the documentation on MXML Configuration

AS3Commons

As a side project, we have started the AS3Commons project that offers reusable ActionScript 3.0 libraries. Most of the libraries currently available in AS3Commons are build using code from the Spring ActionScript framework. This means that a lot of code has been removed from Spring ActionScript and is now available for use in projects not using Spring ActionScript. Please note that you might have to update quite some import statements to refer to AS3Commons instead of Spring ActionScript. We apologize for any inconvenience this might cause, but this is only a one-time process.

We hope you find the AS3Commons libraries useful. All libraries (releases and snapshots) can also be found at the Maven repository.

Documentation

The documentation has been tremendously improved in this version. Next to the API documentation, we now provide a reference guide in HTML and PDF format. General info can be found at the project website: www.springactionscript.org

Last Words

If you feel like helping us out, we could certainly use your help. This project is entirely created on a volunteer basis and in our spare (and limited) free time so needless to say that the more people, the faster we can deliver new releases and guarantee the quality of the framework. So if you think you have someting to offer, be it as a developer, tester, documentation writer, sample creator, … please contact me (christophe [DOT] herreman [AT] gmail [DOT] com) or leave something in the comments. All help is more than welcome.

Enjoy this release and have fun coding!