# Lua tracker SDK
> Track events in Lua applications with the Snowplow Lua tracker SDK, compatible with Lua 5.1+ and LuaJIT.
> Source: https://docs.snowplow.io/docs/sources/lua-tracker/
> Documentation index: https://docs.snowplow.io/llms.txt

[Actively maintained](/docs/sources/tracker-maintenance-classification/ "Production ready, frequent releases, dependencies kept up to date")

Feature support [Compare trackers](/docs/sources/#compare-trackers)

- Supported: Page or screen views (Screen)
- Not supported: Activity tracking
- Not supported: Built-in entities
- Not supported: Anonymous tracking
- Not supported: Media
- Not supported: Ecommerce
- Not supported: Consent
- Not supported: Snowtype

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

The current version is 0.2.0. 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](https://snowplow.github.io/snowplow-lua-tracker/).

## Getting Started

### Requirements

Ensure you have the following installed on your system:

- [Lua](https://www.lua.org/) version >= 5.1
- [LuaRocks](https://luarocks.org/) (Lua's dependency manager)
- curl

If using `brew`, simply run:

```bash
brew install lua luarocks curl
```

### Installation

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

```bash
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.

```bash
luarocks install snowplowtracker CURL_DIR=/usr/local/Cellar/curl/7.82.0/
```

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

```gradle
dependencies = {
  ...
  "SnowplowTracker"
}
```

### 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](/docs/events/custom-events/#structured-events) can be done as follows:

```lua
local snowplow = require("snowplow")
local tracker = snowplow.new_tracker("{{ collector_url }}")

tracker:track_struct_event("category", "action", "label", "property", 10)
```

Visit documentation about [tracking events](/docs/sources/lua-tracker/tracking-specific-events/) to learn about other supported event types.
