zpl.track is a cross-platform event tracker that can send your event data to a UDP echo server. You can then pipe the telemetry data to any destinations desired. It aims to be very minimalist and easy to integrate.
There are several options in getting hands-on this library:
curl -L https://github.com/zpl-c/track/releases/latest/download/track.h > track.h
# OR
wget https://github.com/zpl-c/track/releases/latest/download/track.h -O track.h
This approach will download the latest release of zpl.track with everything prepared for you.
- Navigate to the releases page of the zpl.track repository and pick the version you want to use. Each release contains the distributed version of zpl.track for you to use easily.
- Clone the repository by pressing the Clone or download button for instructions or use your terminal to clone:
git clone https://github.com/zpl-c/track.git
We use this method to develop zpl.track as it contains all the development sources that are easy to modify and expand, but it is not suitable for use in production.
Please follow the CONTRIBUTING.md guide to learn how to contribute to the project.
We use CMake to generate project files. You can do the following on the command line to create and build this project:
cmake -S misc -B build
cmake --build build
Run build/echo
first, then run the compiled build/demo
.
We offer a simple to use NodeJS library to receive telemetry data from zpl.track. You can check it out on npm registry or by installing the package locally using:
npm install --save zpl.track
# OR
yarn install zpl.track
#define TRACK_IMPL
#include <track.h>
#include <stdlib.h> // for rand, srand
#include <time.h> // for time
#include <string.h> // for printf, snprintf
int err = 0;
#define CHECK(code)\
err = code;\
if (err) {\
printf("error code: %d\n", err);\
track_destroy();\
return err;\
}
int main() {
srand(time(NULL)*time(NULL));
CHECK(track_init("127.0.0.1", "8200"));
char userId[13] = {0};
snprintf(userId, 13, "id-%d", rand()%99999);
CHECK(track_ident(userId, "{\"demoId\": 42, \"name\": \"Jane Doe\"}"));
CHECK(track_event("demo_app opened", userId, "{\"foo\": 123, \"open_timestamp\": 123893893}"));
CHECK(track_event("demo_app action", userId, "{\"foo\": \"bar\"}"));
CHECK(track_group(userId, "abc", "{\"demoId\": 42, \"name\": \"Jane Doe\"}"));
track_prop props[] = {
{"mode", "\"demo\""},
{"speed", "\"fast\""},
{"contains_bugs", "false"},
{0}
};
CHECK(track_event_props("demo_app submitted", userId, props));
CHECK(track_destroy());
return 0;
}
We discontinued the outdated library due to its complexity and reliance on cURL and CMake. We made modifications and streamlined the API for simplicity and performance. The old version can still be accessed here, but we don't provide support for it.
See LICENSE for the license.