Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alekseypleshkov/go-analytics-api
It's small analytics microservice for storing data to db.
https://github.com/alekseypleshkov/go-analytics-api
Last synced: 8 days ago
JSON representation
It's small analytics microservice for storing data to db.
- Host: GitHub
- URL: https://github.com/alekseypleshkov/go-analytics-api
- Owner: AlekseyPleshkov
- Created: 2022-07-30T07:56:31.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-05-15T21:11:18.000Z (over 1 year ago)
- Last Synced: 2024-05-16T01:03:37.550Z (6 months ago)
- Language: Go
- Homepage:
- Size: 29.3 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 📦 Go Analytics API
It's small analytics microservice for storing data to db.
**Not ready for use!**
## Plans
- [x] Basic structure
- [x] Requests validation
- [x] Unit tests (partial coverage)
- [ ] Request for get filtered data
- [ ] Analytics visualisation (graphs)## Contents
- [Installation](#installation)
- [How to use](#how-to-use)
- [Compact](#compact)
- [Detailed](#detailed)## Installation
- Clone or download project;
```
# git clone [email protected]:AlekseyPleshkov/go-analytics-api.git
```
- Create `config.yml` file in the project directory. Set correctly data for postgres and generate unique token for requests;
```
token: 'PLACE YOUR SECUTIRY TOKEN FOR REQUESTS'
host: '0.0.0.0:8080'
db:
host: 'localhost'
port: '5432'
username: 'postgres'
password: 'postgres'
database: 'analytics'
```
- Create docker image and start container. You can add this Dockerfile to exists docker-compose file in your ecosystem;
```
# docker build --no-cache -t go-analytics-api .
# docker run -d -p 8080:8080 --restart=always --name go-analytics-api go-analytics-api
```
- Or start microservice without docker;
```
# go build cmd/main.go
# ./main
```## How to use
Requests should be sent with parameter `token` in header with value from `config.yml`
### Compact
Save simple analytics data with dynamic structure.
```
{POST} /analytics/v1/compact{
"user_id": string,
"platform": string,
"data": object
}
```- `user_id` is unique user identifier
- `platform` is application who send analytics data (ios, android, device-service-api and etc.)
- `data` is object with custom key/value data for save to db### Detailed
Save detailed analytics data with more important parameters.
```
{POST} /analytics/v1/detailed{
"user_id": string,
"platform": string,
"event": string,
"category": string?,
"value": string?,
"additionals": object?
}
```- `user_id` is unique user identifier
- `platform` is application who send analytics data (ios, android, device-service-api and etc.)
- `event` is name of analytics event (click, visit, tap, open and etc.)
- `category` is type of event (button, link, screen and etc.)
- `value` is detailed information about event ("Primary Button", "Sum field" and etc.)
- `additionals` is object with custom key/value data for save additionals information