Skip to content

nozgurozturk/noo-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

noo-analytics

Simple backend service for personal websites

Install

First of all, download and install Go. 1.14 or higher is required.

When installation is done clone the repo with command:

git clone https://github.com/nozgurozturk/noo-analytics

After that install missing dependencies with command:

go mod tidy

Run the app

go run ./cmd/server

Database Support

noo-analytics works with MongoDB and Redis

Environment Variables

MongoDB Variables:

MONGO_DB_USERNAME = 
MONGO_DB_PASSWORD = 
MONGO_DB_HOST = 
MONGO_DB_PORT = 
MONGO_DB_NAME = 
MONGO_DB_QUERY = 

Redis Variables:

REDIS_DB_ADDRESS = 
REDIS_DB_USERNAME =
REDIS_DB_PASSWORD =

Server Variables:

PORT = 
ACCESS_SECRET = 
REFRESH_SECRET = 
# Hour
ACCESS_EXPIRE =
# Minute
REFRESH_EXPIRE = 
ADMIN_MAIL = 

API Documentation

Send User Trace

Request

POST /trace

{
  "ip": "192.168.0.1",
  "loc": "TUR",
  "a": "Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0",
  "act": 1,
  "tag": "home"
}   

Response

    {}

Find Action by Date

Request

  • year, month, day and hour are objects are optional
  • range and its properties are optional

POST /analytics/action/date

{
    "action": 1,
    "year":{
        "isInclude": true,
        "range": {
          "from": 2018,
          "to": 2020
        }
    },
    "month":{
        "isInclude": true,
        "range": {
          "from": 2018,
          "to": 2020
        }
    },
    "day":{
        "isInclude": true,
        "range": {
          "from": 2018,
          "to": 2020
        }
    },
    "hour":{
        "isInclude": true,
        "range": {
          "from": 2018,
          "to": 2020
        }
    }
}

Response

y: year | m: month | d: day | h: hour | v: visitors' ip | uv: unique visitors' ip

[
    {
        "y": 2020,
        "m": 11,
        "d": 6,
        "h": 0,
        "v": [
            "192.168.0.1"
        ],
        "uv": [
            "192.168.0.1"
        ]
    },
    {
        "y": 2020,
        "m": 10,
        "d": 6,
        "h": 0,
        "v": [
            "192.168.0.1"
        ],
        "uv": [
            "192.168.0.1"
        ]
    },
    {
        "y": 2020,
        "m": 10,
        "d": 4,
        "h": 0,
        "v": [
            "192.168.0.1",
            "192.168.0.2",
            "192.168.0.1"
        ],
        "uv": [
            "192.168.0.1",
            "192.168.0.2"
        ]
    }
]

Login

Request

POST /auth/login

{
  "email": "example@mail.com",
  "password": "sample_password"
}   

Response

{
    "name": "Sample Name",
    "email": "example@mail.com"
} 

Sign Up

Request

POST /auth/signup

{
  "name": "Sample Name",
  "email": "example@mail.com",
  "password": "sample_password"
}   

Response

{
    "name": "Sample Name",
    "email": "example@mail.com"
} 

Error

Response

{
    "message": "Not Accessible",
    "error": "unauthorized",
    "status": 401
}

About

Nooa is a simple and fast website analytics tool.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages