Collecting data with Trackers and Webhooks

  1. Home
  2. Docs
  3. Collecting data with Trackers and Webhooks
  4. Trackers – collecting data from your own applications
  5. Unity Tracker
  6. Tracker

Tracker

The Tracker object is responsible for co-ordinating the saving and sending of events as well as managing the optional Session object.

Constructor

Argument NameDescriptionRequired?Default
emitterThe Emitter object you createYesNull
trackerNamespaceThe name of the tracker instanceYesNull
appIdThe application IDYesNull
subjectThe Subject that defines a userNoNull
sessionThe Session object you createNoNull
platformThe device the Tracker is running onNoMobile
base64EncodedIf we base 64 encode json valuesNoTrue

A full Tracker construction should look like the following:

IEmitter e1 = new AsyncEmitter ("com.collector.acme") Subject subject = new Subject(); Session session = new Session(); Tracker t1 = new Tracker(e1, "Namespace", "AppId", subject, session, DevicePlatforms.Desktop, true);

All of these variables can be altered after creation with the accompanying tracker.SetXXX() function.

Functions

The Tracker also contains several critical functions that must be used to start Tracking.

StartEventTracking()

This function must be called before any events will start being stored or sent. This is due to the fact that we do not want to start any background processing from the constructors so it is left up to the developer to choose when to start everything up.

This function:

  • Starts the background emitter thread
  • Starts the background event processor thread
  • Starts the background session check timer (Optional)

Once this is run everything should be in place for asynchronous event tracking.

StopEventTracking()

If you need to temporarily halt the Tracker from tracking events you can run this function. This will bring all event processing, sending and collection to a halt and nothing will be started again until StartEventTracking() is fired again.

Track(IEvent)

This is the function used for Tracking all events.

tracker.Track(IEvent newEvent);