Giter Club home page Giter Club logo

minimal-analytics's Introduction

minimal-analytics

minimal analytics dashboard

Read more about the project at cri.dev - "Making Minimal Analytics"

See Minimal Analytics in action

Table of contents

requirements

  • node.js 16+ (16.16.0 lts recommended)

how to self-host

1. clone the repo

git clone https://github.com/christian-fei/minimal-analytics.git

2. create a production configuration for docker-compose

cp docker-compose.yml docker-compose.prod.yml

change the environment variable STATS_BASE_URL to your own domain for minimal-analytics, e.g. https://stats.example.com

change the environment variable SITE_BASE_URL to your own domain for the site you want to track, e.g. https://example.com

3. run the service

run the update.sh script to start the server

4. include client.js in your site

replace STATS_BASE_URL with your own domain for minimal-analytics, e.g. https://stats.example.com and include the following in your site

<script async defer src="https://STATS_BASE_URL/client.js"></script>

optional: 5. configure nginx

configure the nginx reverse proxy like so:

sudo cp nginx.conf /etc/nginx/sites-available/minimal_analytics

changing the placeholder YOUR_STATS_DOMAIN to e.g. stats.example.com, in the /etc/nginx/sites-available/minimal_analytics file.

then link to the enabled sites

sudo ln -s /etc/nginx/sites-available/minimal_analytics /etc/nginx/sites-enabled/minimal_analytics

and reload nginx

sudo systemctl reload nginx
# or
sudo nginx -s reload

local installation

install the server dependencies with

npm i

and then install the client dependencies in the dashboard directory

cd dashboard
npm i

build client

the client uses parcel as a asset bundler.

you can run a build of the dashboard, the output will be in dashboard/dist and served from http://127.0.0.1:8080 when starting the server

cd dashboard
npm run build

start minimal-analytics - with npm

Run touch data/data.ljson to create an empty file used to keep track of pageviews.

Set the environment variables STATS_BASE_URL and SITE_BASE_URL and run npm start, e.g.

SITE_BASE_URL=http://127.0.0.1:8081 STATS_BASE_URL=http://127.0.0.1:8080 npm start

alternatively, using direnv, create a .env file by copying the example file: cp .env.example .env and configure the variables.

The configured site to track is running on http://127.0.0.1:8081, described by SITE_BASE_URL

The minimal-analytics server runs at STATS_BASE_URL http://127.0.0.1:8080

start minimal-analytics - with docker-compose

configure the environment variables in docker-compose.yml regarding STATS_BASE_URL and SITE_BASE_URL.

STATS_BASE_URL is the location where the minimal-analytics is running, e.g. https://stats.example.com

SITE_BASE_URL is the location of the site you want to allow tracking, e.g. https://example.com

Run the service with

docker-compose up -d --build --remove-orphans --renew-anon-volumes

tests

Run touch data/test.ljson to create an empty file used for tests

Run npm t in the root of the project to run the server tests.

If you want to run the client dashboard tests, npm t in the dashboard directory

minimal-analytics's People

Contributors

christian-fei avatar

Stargazers

yücel avatar Vittor avatar HonzaBe avatar Ozgur Dogan Ugurlu avatar ひるき avatar François Michaud avatar  avatar Huw Fulcher avatar Charlie avatar Zhibo avatar Alessio Biancalana avatar Michele Pangrazzi avatar Tommi avatar Viking Zhang avatar Sevi avatar  avatar Fabian Knaack avatar Juri Hahn avatar Fabian Mersch avatar Robert Michalski avatar Alexis Tyler avatar Daniel Stefanovic avatar Yann  avatar Manish Kc avatar cocoonk1d avatar Lorenzo Millucci avatar Taylor D. Edmiston avatar Brendan avatar  avatar Sagun Shrestha avatar Sean Powell avatar Fredrik Pettersen avatar Markus avatar Nikolay Kolev avatar Florian Hämmerle avatar Robertus Suhendro avatar Bharat Mandava avatar Felix avatar khimaros avatar Youssef avatar Umar Hansa avatar Michael Jett avatar Andreas Wagner avatar Guo Lijun avatar ferrie = differentieel avatar Christoph Grabo avatar Antonio Villamarin avatar Roberto Salas avatar Algustionesa Yoshi avatar gaurav patel avatar  avatar Sylvain Rio avatar Tomas Čerkasas avatar Andrew Davidson avatar Mehdi avatar Jason H avatar  avatar

Watchers

James Cloos avatar  avatar

minimal-analytics's Issues

[npm audit] Update Ava

Some of its dependencies represent some security problems.
node-static too but I don't know if there is a replacement.

[feature] Put time on graph

I think it would be very useful to have time on X axis of the graph

ps: I could work on this if you like but later in the following days.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.