A minimal, self-hosted event tracking services, built with SQLite (Knex), using NodeJS.
- Setup
-
Server APIs
- Create event: [POST] /tc
- Query data: [GET] /tc?{query}={value}
Asume you have clone or download the project to your machine. Once your server is running, the server should be accessable via //localhost:8080
or as configed.
You can run using pm2, or as a node application as below:
PM2 is a node process manager. A ecosystem.config.js config file should be ready to use. You can also customize as you want. Once completed, start the pm2 process:
$ pm2 start
- Setup enviroment variables by copy
.env.blank
content to a new.env
file - Setup connection by run
yarn setup
ornpm run setup
- Start server by run
yarn start
ornpm start
Server APIs are exposed through TRACIE_ENDPOINT
path setup on the .env
file.
[POST] /tc
Body content must contains a name
property
{
"name": "string"
}
[GET] /tc?{query}={value}
Available queries params:
Name | Type and value | Definition |
---|---|---|
$name |
string |
event names, separate by a comma (.ie signup,hits) |
$interval |
month , week , day , hour , minute
|
group result by an interval unit |
$intervalValue |
number |
period of $interval i.e 2 days, 3 weeks |
$start |
number , string
|
starting time in milliseconds or a valid JS date string |
$end |
number , string
|
ending time in milliseconds or a valid JS date string |
Query output
{
data: [{
name: string,
result: {
[date: string]: number
}
}]
}
Where
-
name
: event name -
date
: ISODate format string -
date
's value: the frequency number