GaforFlash is a lib with an API for Google Analytics data collection. It works as a standalone lib or as a Flash/Flex component.
Sample
package { import fl.video.FLVPlayback; import com.google.analytics.AnalyticsTracker; import flash.events.MouseEvent; /** * The VideoTracker sample class. */ public class VideoTracker { private var _tracker:AnalyticsTracker; private var _vid:FLVPlayback; /** * Creates a new VideoTracker instance. */ public function VideoTracker( tracker:AnalyticsTracker , vid:FLVPlayback ) { this._tracker = tracker; this._vid = vid; /* All tracking of clicks is done below. Here we track clicks instead of FLV VideoEvents * because the we want to track user interaction and the player sends VideoEvents even * when a user doesn't click on anything. */ _vid.playButton.addEventListener( MouseEvent.CLICK, onPlayEvent ); _vid.stopButton.addEventListener( MouseEvent.CLICK, onStopEvent ); _vid.pauseButton.addEventListener( MouseEvent.CLICK, onPauseEvent ); _vid.backButton.addEventListener( MouseEvent.CLICK, onBackEvent ); _vid.forwardButton.addEventListener( MouseEvent.CLICK, onForwardEvent ); } public function onBackEvent(e:MouseEvent):void { _tracker.trackEvent( "video", "back" ); } public function onForwardEvent(e:MouseEvent):void { _tracker.trackEvent( "video", "fast_forward" ); } public function onPauseEvent(e:MouseEvent):void { _tracker.trackEvent( "video", "pause" ); } public function onPlayEvent(e:MouseEvent):void { _tracker.trackEvent( "video", "play" ); } public function onStopEvent(e:MouseEvent):void { _tracker.trackEvent( "video", "stop" ); } } }
New: GaforFlash (API for Google Analytics data collection) http://t.co/op0qdEh1 #as3 #flash #gamedev