Module Tracker

The Snowplow tracker

Info:

  • Copyright: Copyright (c) 2013 - 2022 Snowplow Analytics Ltd
  • License: Apache License Version 2.0
  • Author: Alex Dean

Functions

tracker.new_tracker (emitter[, encode_base64=true]) Creates a new tracker instance.
encode_base64 (encode) Configuration setting: whether to Base64-encode the properties of unstructured events and custom variables.
platform (platform) The default platform for Lua is "pc".
set_app_id (app_id) Sets the application ID.
set_user_id (user_id) Sets the business user ID.
set_screen_resolution (width, height) Sets the screen resolution.
set_viewport (width, height) Sets the viewport size.
set_color_depth (depth) Sets the bit depth of the color palette.
track_screen_view (name, id) Sends a screen view event to Snowplow.
track_struct_event (category, action[, label[, property[, value]]]) Sends a custom structured event to Snowplow.
track_self_describing_event (schema, data) Sends a custom unstructured event to Snowplow.

Tables

Tracker The Tracker table.


Functions

tracker.new_tracker (emitter[, encode_base64=true])
Creates a new tracker instance.

Parameters:

  • emitter Emitter The emitter to use to send the payloads
  • encode_base64 bool Whether to base64 encode the payloads (default true)

Returns:

    Tracker The new tracker
encode_base64 (encode)
Configuration setting: whether to Base64-encode the properties of unstructured events and custom variables. Encoding means a circa~25% space saving. Defaults to true.

Parameters:

  • encode bool Whether to base64-encode or not
platform (platform)
The default platform for Lua is "pc". If you are using Lua on another platform, (e.g. as part of a console videogame), you can change the platform here. For details on the different platforms, see: https://github.com/snowplow/snowplow/wiki/SnowPlow-Tracker-Protocol#wiki-appid

Parameters:

  • platform string The short-form name of the platform to set. Can be "pc", "tv", "mob", "csl" or "iot".
set_app_id (app_id)
Sets the application ID.

Parameters:

  • app_id string The application ID to set
set_user_id (user_id)
Sets the business user ID.

Parameters:

  • user_id string The business user ID to set.
set_screen_resolution (width, height)
Sets the screen resolution.

Parameters:

  • width number The screen width
  • height number The screen height
set_viewport (width, height)
Sets the viewport size.

Parameters:

  • width number The viewport width
  • height number The viewport height
set_color_depth (depth)
Sets the bit depth of the color palette.

Parameters:

  • depth number The color depth on this computer
track_screen_view (name, id)
Sends a screen view event to Snowplow. A screen view must have a `name` and can have an optional `id`.

Parameters:

  • name string Human-readable name for this screen (e.g. "HUD > Save Game").
  • id string Optional unique identifier for this screen. Could be e.g. a GUID or identifier from a game CMS

Returns:

  1. boolean Whether event was successfully collected
  2. optional string The reason for failure if not
track_struct_event (category, action[, label[, property[, value]]])
Sends a custom structured event to Snowplow.

Parameters:

  • category string The category of event
  • action string The action / event itself
  • label string The ‘object’ the action is performed on (optional)
  • property string A property associated with either the action or the object (optional)
  • value string A value associated with the user action (optional)

Returns:

  1. boolean Whether event was successfully collected
  2. optional string The reason for failure if not
track_self_describing_event (schema, data)
Sends a custom unstructured event to Snowplow.

Parameters:

  • schema tab The schema for this event
  • data tab The key, value pairs to send with the event

Returns:

  1. boolean Whether event was successfully collected
  2. optional string The reason for failure if not

Tables

Tracker
The Tracker table.

Fields:

  • encode_base64 func
  • platform func
  • set_app_id func
  • set_user_id func
  • set_screen_resolution func
  • set_viewport func
  • set_color_depth func
  • track_screen_view func
  • track_struct_event func
  • track_self_describing_event func
generated by LDoc 1.4.6 Last updated 2022-04-28 16:24:12