Posted By

adrianparr on 06/03/10


Tagged

gaforflash


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

sweetbabyyoung
donaldleegraham
tspitzr
mitien


AS3 Using Google Analytics in Flash (gaforflash) to Track Events


 / Published in: ActionScript 3
 

URL: http://code.google.com/p/gaforflash/

Some useful tutorials for doing this can be found here ... http://inflagrantedelicto.memoryspiral.com/2009/10/presentation-for-fitc-adobe-max-2009/ http://www.insideria.com/2009/02/using-google-analytics-within.html http://tv.adobe.com/watch/under-the-hood-with-adobe/google-analytics-for-adobe-flash http://tv.adobe.com/watch/max-2008-envision/tracking-flash-cs4-applications-with-google-analytics

  1. // For Google Analytics tracking to work you need to link
  2. // to the following two SWC files in Flash CS4 and above ...
  3. // 'analytics.swc' and 'analytics_flash.swc'
  4. // Download them from here http://code.google.com/p/gaforflash/
  5. import com.google.analytics.GATracker;
  6. import com.google.analytics.AnalyticsTracker;
  7.  
  8. var tracker:AnalyticsTracker;
  9.  
  10. //GATracker(display:DisplayObject, account:String, mode:String = "AS3", visualDebug:Boolean = false, config:Configuration = null, debug:DebugConfiguration = null);
  11. tracker = new GATracker(this, "UA-XXXXXXX-X", "AS3", true);
  12.  
  13. // Google Analytics Event Tracking Example
  14. // trackEvent(category:String, action:String, label:String = null, value:Number);
  15. tracker.trackEvent("MyProject", "ButtonClicked", "HomeButton");

Report this snippet  

You need to login to post a comment.