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. Setup

Setup

Integration options

Tracker compatibility

As a lightweight, easily-embeddable scripting language, Lua is available in a huge number of different computing environments and platforms, from World of Warcraft through OpenResty to Adobe Lightroom.

To make the Snowplow Lua Tracker work out-of-the-box with as many different Lua programs as possible, we have tried to:

  1. Minimize external dependencies
  2. Provide setup instructions for the most popular Lua environments

Dependencies

To make the Snowplow Lua Tracker work with as many different Lua programs as possible, we have tried to keep external dependencies to a minimum. There is only one external dependency currently:

  • LuaSocket – network support for the Lua language. Required to send events to the Snowplow collector

All other dependencies are bundled with the Lua Tracker itself – see the src/lib folder for details.

Documented environments

Below we provide setup instructions for the following popular Lua environments:

  1. LuaRocks is a popular deployment and management system for Lua modules
  2. Debian/Ubuntu for developers working directly with Lua in a Linux environment
  3. Embedded environments for game, app and SDK developers working with embedded Lua

We expect that the Snowplow Lua Tracker should work in other Lua environments too.

Setup

LuaRocks

The Snowplow Lua Tracker is published to LuaRocks, the popular deployment and management system for Lua modules.

This makes it easy to either install the tracker locally, or to add it as a dependency into your own LuaRocks-based app.

To install the Snowplow Lua Tracker locally (assuming you already have LuaRocks installed):

$ luarocks install SnowplowTracker

To add the Snowplow Tracker as a dependency to your own LuaRocks-based app, edit your rockspec and add:

dependencies = { "SnowplowTracker ~> 0.1.0" }

Debian/Ubuntu

If your Lua app is running on a Linux box, you will need to install Lua and LuaSocket. On Ubuntu:

$ sudo aptitude install lua liblua5.1-socket2

On Debian:

$ sudo apt-get install lua liblua5.1-socket2

Then download the Snowplow Lua Tracker like so:

$ git clone git@github.com:snowplow/snowplow-lua-tracker.git

Copy the /src/snowplow folder into your own Lua app’s library folder, something like:

$ cp -r snowplow-lua-tracker/src/snowplow my-app/lib/

Now add the Snowplow Lua Tracker into your Lua app’s package.path, like so:

package.path = './lib/?.lua;' .. './lib/snowplow/?.lua;' .. package.path

Embedded environments

For embedded Lua environments, you will first need to ensure that LuaSocket is available (or installable). Here are instructions for adding LuaSocket into some popular games, SDKs and other apps which use Lua:

Game/app/SDKLuaSocket bundled?Installation instructions
cocos2d-xNoInstallation instructions
Garry’s ModNoPort of LuaSocket for GMod
Cheat EngineNoInstallation instructions
GirderYes (ref)Enable the plugin from Girder Settings
Corona SDKYes (ref)
LÖVEYes (ref)
MoaiYes (ref)
World of WarcraftYes (ref)

LuaSocket taken care of? Next, download the Snowplow Lua Tracker like so:

$ git clone git@github.com:snowplow/snowplow-lua-tracker.git

Now copy the /src/snowplow folder into the folder for your Lua scripts, perhaps something like:

$ cp -r snowplow-lua-tracker/src/snowplow my-app/lua-scripts/lib/

Now add the Snowplow Lua Tracker into your Lua app’s package.path, like so:

package.path = './lib/?.lua;' .. './lib/snowplow/?.lua;' .. package.path