Haxe & Google Flash Analytics
I investigated how to use the recently relased google analytics flash tracking with Haxe. The solution is simple, and I prepared an out-of-the box demo pack.Start downloading google_analytics_flash_haxe_demo.zip and read on for details (or see the included readme)
Instructions for compiling:
- unzip the package
- edit Main.hx and replace your google analytics code
- swfmill simple res.xml library.swf
- haxe build.hxml
- flashplayer_dbg test.swf (don't forget allowscriptaccess=always when embedding the swf on a website)
Details:
- I downloaded the compiled AnalyticsLibrary AS3 lib
- after unzipping analytics.swc (swc is zip with different extension), I renamed the extracted library.swf to ga.swf
- generated hxclasses with haxe, fixed XML import in two generated header files
- in the swfmill resource xml, I included the ga.swf on the first frame (note: this may do the trick for other libraries as well, not just ga-flash)
- the demo code is based on the demo code found @ http://code.google.com/apis/analytics/docs/flashTrackingIntro.html
Comments
Comment by [ron], (URL) on 09.04.16. 16:37
Unfortunately it seems that this technique cannot be used to track live events in a game for example, because each single analytics request is instantly sent, and results in a well noticable lag in the game.
Comment by Tarwin, () (URL) on 09.08.04. 09:36
Sweet! Thanks for that.
I did things a little differently.
- Copied the intrinsics you made for haXe to my src folder
- Added the SWC to the “Library path” (CS4 only, Publish Settings->Flash->ActionScript 3.0->Settings).
- Added “import com.google.analytics.GATracker;” and “com.google.analytics.GATracker;” to the timeline to make sure that the classes were compiled.
- Used the SWF as a library ie “-swf-lib FLASH/lib.swf” (added in FlashDevelop Project->Properties->Compiler Options->Additional Compiler Options)
Comment by [ron], (URL) on 09.08.04. 18:26
Nice! Having the Flash IDE helps in this case :)
Comment by Cristi Baluta, () (URL) on 09.12.13. 06:05
for me the additional 98k added to the file is a disaster, i’m trying to port only the basic functionality directly to haxe but it’s hard to understand what they have done there.
Comment by joint pains, () (URL) on 11.09.15. 11:44
thanks for the great post!
Comment by LV Bags, () (URL) on 11.10.08. 13:09
It is part of a flurry of activity over the weekend which will also see the French leader visit Berlin for talks with German Chancellor Angela Merkel.They will discuss how to help banks over-exposed to sovereign debt.The European Commission has urged member states to draft a bailout plan to restore confidence in banking.However, Germany and France, the eurozone’s dominant economic powers, have yet to agree on the way to proceed.On Friday, the international ratings agency Fitch downgraded the sovereign credit ratings of Italy and Spain, putting new pressure on two of the eurozone’s biggest economies.
Comment by coach purses, () (URL) on 11.10.29. 07:13
Coach is one of the most distinguished leather brand all over the world. You can find many wonderful cheap Coach Purses on our Coach Factory Stores
Comment by coach outlet store online, () (URL) on 11.10.29. 08:12
coach outlet store online has been voted by Hour Detroit magazine readers as the Best of Detroit in their 12th annual readers’poll. Coach Outlet Store is in part simply a response to consumer demand. Consumers accept the notion of the desirability of select consumer product brands and designer labels.
Comment by coach outlet, () (URL) on 11.10.29. 11:24
coach outlet has a zippered closure and buckles for extra security. Shiny brass hardware, rounded leather handle, and an interior pocket. It also includes a limited edition Hawaii luggage tag and lock. Here you can find the latest products in different kinds of coach outlet store online making best materials.They are leisure practical products in the new generations.
Comment by herve leger, () (URL) on 11.11.28. 07:21
Nice to be visiting your blog again Herve Leger, it has been months for me. Well this article that i’ve been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article Herve Leger Dresses. Thanks, great share.
Comment by evening dress, () (URL) on 11.11.29. 10:31
Right, I am fully agree with your post.This kind of evening dress is so perfect.Not only cheap but also beautiful.I like it so much and hope you will like it too!
Comment by uggs outlet, () (URL) on 12.01.02. 09:11
It’s good to see this information in your post, I was looking the same but there was not any proper resource, thanks now I have the link which I was looking for my research.
