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. Lua tracker
  6. Configuration

Configuration

Configuring your tracker

Each tracker instance is initialized with sensible defaults:

  • The platform the tracker is running on is set to “pc”
  • Property data for unstructured events is sent Base64-encoded

However you can change either of these defaults:

Change the tracker”s platform with platform()

You can change the platform the tracker is running on by calling:

t:platform( "{{PLATFORM CODE}}" )

For example:

t:platform( "tv" ) -- Running on a Connected TV

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

Disable Base64-encoding with encodeBase64()

You can set whether or not to Base64-encode property data for unstructured events by calling:

t:encodeBase64( {{true OR false}} )

So to disable it and send the data URI-encoded instead:

t:encodeBase64( false )

Adding extra data

You may have additional information about your application”s environment, current user and so on, which you want to send to Snowplow with each event.

The tracker instance has a set of set...() methods to attach extra data to all tracked events:

We will discuss each of these in turn below:

Set application ID with setAppId()

You can set the application ID to any string:

t:setAppId( "{{APPLICATION ID}}" )

Example:

t:setAppId( "wow-addon-1" )

Set user ID with setUserId()

You can set the user ID to any string:

t:setUserId( "{{USER ID}}" )

Example:

t:setUserId( "alexd" )

Set screen resolution with setScreenResolution()

If your Lua code has access to the device”s screen resolution, then you can pass this in to Snowplow too:

t:setScreenResolution( {{WIDTH}}, {{HEIGHT}} )

Both numbers should be positive integers; note the order is height followed by width. Example:

t:setScreenResolution( 1366, 768 )

Set color depth with setColorDepth()

If your Lua code has access to the bit depth of the device”s color palette for displaying images, then you can pass this in to Snowplow too:

t:setColorDepth( {{BITS PER PIXEL}} )

The number should be a positive integer, in bits per pixel. Example:

t:setColorDepth( 32 )