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

Lua Tracker

Early Release

The Snowplow Lua Tracker allows you to track Snowplow events in your Lua applications.

It is compatible with Lua >= 5.1, along with LuaJIT.

This will help you set up the Lua tracker and get started tracking. For more technical details, you can visit the API docs.

Getting Started

Requirements

Ensure you have the following installed on your system:

  • Lua version >= 5.1
  • LuaRocks (Lua’s dependency manager)
  • curl

If using brew, simply run:

brew install lua luarocks curl

Installation

Once these are installed, you can install the tracker using LuaRocks:

luarocks install snowplowtracker

Note: You may find that you need to pass in the CURL_DIR flag if Lua cannot find curl by itself. Below is an example if curl was installed using brew on an Intel Mac.

luarocks install snowplowtracker CURL_DIR=/usr/local/Cellar/curl/7.82.0/
Code language: JavaScript (javascript)

Or, add the Snowplow Tracker to the dependencies section of your rockspec (Note: you may still have to pass CURL_DIR when installing):

dependencies = { ... "SnowplowTracker" }
Code language: Lua (lua)

Tracking Events

To track an event, simply create a tracker instance and call one of the track_* methods. For example, simple tracking of a structured event:

local snowplow = require("snowplow") local tracker = snowplow.new_tracker("{{ collector_url }}") tracker:track_struct_event("category", "action", "label", "property", 10)
Code language: Lua (lua)

Visit documentation about tracking events to learn about other supported event types.

Articles

If you’d like to learn more about Snowplow BDP you can book a demo with our team, or if you’d prefer, you can try Snowplow technology for yourself quickly and easily.