Skip to main content


Assuming you have completed the Actionscript 3 Tracker Setup for your project, you are now ready to initialize the AS3 Tracker.

Importing the module

Import the AS3 Tracker's classes into your AS3 code like so:

import com.snowplowanalytics.snowplow.tracker.*;
import com.snowplowanalytics.snowplow.tracker.emitter.*;
import com.snowplowanalytics.snowplow.tracker.payload.*;

That's it - you are now ready to initialize a Tracker instance.

Creating a Tracker

To instantiate a tracker in your code simply instantiate the Tracker interface:

Tracker(emitter:Emitter, namespace:String, appId:String, subject:Subject, stage:Stage = null, base64Encoded:Boolean = true)

For example:

var t1:Tracker = new Tracker(emitter, "AF003", "cf", user1Subject, this.stage, true);
Argument NameDescriptionRequired?
emitterThe Emitter object you createYes
namespaceThe name of the Tracker instanceYes
appIdThe application IDYes
subjectThe Subject that defines a userNo (default null)
stageThe stage property of a DisplayObjectNo (Default null)
base64EncodedWhether to enable base 64 encodingNo (Default true)


The emitter to which the tracker will send events. See Emitters for more on emitter configuration.


The user which the Tracker will track. This should be an instance of the Subject class. You don't need to set this during Tracker construction; you can use the Tracker.setSubject method afterwards. In fact, you don't need to create a subject at all. If you don't, though, your events won't contain user-specific data such as timezone and language.


If provided, the namespace argument will be attached to every event fired by the new tracker. This allows you to later identify which tracker fired which event if you have multiple trackers running.


The appId argument lets you set the application ID to any string.


By default, unstructured events and custom contexts are encoded into Base64 to ensure that no data is lost or corrupted. You can turn encoding on or off using the Boolean base64Encoded argument.

Change the tracker's platform with setPlatform

You can change the platform by calling:


For a full list of supported platforms, please see the Snowplow Tracker Protocol.

Was this page helpful?