| Package | com.happytoad.libs.riatrax | ![]() |
| Class | public class Tracker |
| Property | Defined by | ||
|---|---|---|---|
| account : String
This String is also known as the Google UA number of your tracking code
and looks like UA-xxxxx-yy, where the x's and y's are replaced with
the numbers that correspond to your account and profile information for
the object you are tracking.
| Tracker | ||
| config : Configuration
Determinates the Configuration object of the tracker.
| Tracker | ||
| debug : DebugConfiguration
Determinates the DebugConfiguration object of the tracker.
| Tracker | ||
| display : DisplayObject
DisplayObject to hold a reference to the object.
| Tracker | ||
| mode : String
String, either bridge mode or AS3 mode.
| Tracker | ||
| trackerCount : int [read-only]
The current total count of events tracked for user session.
| Tracker | ||
| visualDebug : Boolean
Boolean set to true to show visual debugging within your application.
| Tracker | ||
| Method | Defined by | ||
|---|---|---|---|
|
[static]
Returns an instance of Tracker.
| Tracker | ||
|
trackEvent(category:String, action:String, label:String = null, value:Number = 0):Boolean
| Tracker | ||
| account | property |
account:String [read-write]
This String is also known as the Google UA number of your tracking code
and looks like UA-xxxxx-yy, where the x's and y's are replaced with
the numbers that correspond to your account and profile information for
the object you are tracking.
This is a required property and can be obtained from Google.
public function get account():String
public function set account(value:String):void
| config | property |
config:Configuration [read-write]
Determinates the Configuration object of the tracker.
This property defaults to null
public function get config():Configuration
public function set config(value:Configuration):void
| debug | property |
debug:DebugConfiguration [read-write]
Determinates the DebugConfiguration object of the tracker.
This property defaults to null
public function get debug():DebugConfiguration
public function set debug(value:DebugConfiguration):void
| display | property |
display:DisplayObject [read-write]
DisplayObject to hold a reference to the object.
This property should be set to "this".
Example:
Tracker.getInstance().display=this;
public function get display():DisplayObject
public function set display(value:DisplayObject):void
| mode | property |
mode:String [read-write]
String, either bridge mode or AS3 mode. This mode determines how your tracking
communicates with the Analytics servers. ( Bridge | AS3 )
Use Bridge mode if you control both the HTML page and the Flash content.
This mode is best if you have already implemented Google Analytics (ga.js)
tracking on your website and you want to add tracking to embedded Flash content.
The bridge mode simplifies Flash-to-JavaScript communication by providing a unified
ActionScript 3 interface to the ga.js code. It provides the connection from the
ActionScript 3 calls to the Analytics JavaScript in order to make the tracking work.
Use AS3 mode if you control the Adobe Flash ActionScript 3 code, but you do not
control the hosting environment of your Adobe Flash application. For example,
if you are developing Flash content for distribution across many sites, then you
would use AS3 mode. AS3 mode is completely independent from the ga.js tracking code
and contains all the Analytics tracking functionality. There is no need for a separate
ga.js tracking installation with this mode. In addition, AS3 mode uses the Flash storage
mechanism to track session information for the visitor.
For certain DOM parameters such as language, the AS3 component tries to retrieve the
values from the browser. If the values are not present, the component either uses the
Flash equivalent value or defaults to no.
This property defaults to AS3
public function get mode():String
public function set mode(value:String):void
| trackerCount | property |
trackerCount:int [read-only]The current total count of events tracked for user session.
Implementation public function get trackerCount():int
| visualDebug | property |
visualDebug:Boolean [read-write]
Boolean set to true to show visual debugging within your application. ( true | false )
This can be used to test that all is working properly.
This property defaults to false
public function get visualDebug():Boolean
public function set visualDebug(value:Boolean):void
| getInstance | () | method |
public static function getInstance():TrackerReturns an instance of Tracker.
ReturnsTracker —
Tracker
|
| trackEvent | () | method |
public function trackEvent(category:String, action:String, label:String = null, value:Number = 0):BooleanParameters
category:String — String to be passed to Google as the Category property.
|
|
action:String — String to be passed to Google as the Action property.
|
|
label:String (default = null) — String to be passed to Google as the Label property.
|
|
value:Number (default = 0) — Number to be passed to Google as the Value property
|
Boolean — Boolean success or fail returned from Google.
throws Error if category or action is null |
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" xmlns:rx="com.happytoad.libs.riatrax.*"
creationComplete="init()">
<mx:Script>
<![CDATA[
import com.happytoad.libs.riatrax.Tracker;
private var tracker:Tracker = Tracker.getInstance();
private function init():void{
tracker.account="UA-xxxxx-yy";
tracker.display=this;
tracker.visualDebug = true;
}
]]>
</mx:Script>
<rx:Button label="Track Me" horizontalCenter="0" verticalCenter="0"/>
</mx:Application>