A simple yet sufficient server-side analytics library
$ git submodule add https://github.com/ediril/banalytiq.git
$ cd banalytiq
$ php -r "require 'banalytiq.php'; create_db();"
config.yaml
file with your domain name:$ echo "domain: <your-domain-name>" > config.yaml
index.php
<?php
require_once __DIR__ . '/banalytiq/banalytiq.php';
record_visit();
?>
/banalytiq
folder and the modified index.php
to your webserverTODO: We’ll eventually have a way to do this via terminal.
NOTE: You do NOT need to deploy vendor/
folder, that’s only needed for development so the editor
can find the needed function definitions.
$ cd banalytiq
$ php download.php
$ php geo.php
Note: download
script only works with FTP over TLS. It requires PHP to be compiled with OpenSSL support, and it only works with explicit FTPS.
$ php -S localhost:8000
To view the default banalytiq.db
file, simply go to http://localhost:8000
To view a custom db file, go to http://localhost:8000/?db=custom-db-file.db
$ git submodule update --remote
Download and extract GeoLite2-City-CSV_{YYYYMMDD}.zip from MaxMind
> sqlite3 geolite2.db
.mode csv
.import GeoLite2-City-Blocks-IPv4.csv blocks
.import GeoLite2-City-Locations-en.csv locations