Ackee

Ackee is a self-hosted open-source web analytics tool built with Node.js.


Note

For this guide you should be familiar with the basic concepts of

License

Ackee is released under the MIT License.

Prerequisites

Ackee requires a MongoDB database. Set it up using the MongoDB Uberlab guide. You will need your MongoDB admin name and password later.

Starting with Version 2.0.0, Ackee also requires the use of Node.js 14.

[isabell@stardust ~]$ uberspace tools version use node 14
Using 'Node.js' version: '14'
Selected node version 14
The new configuration is adapted immediately. Patch updates will be applied automatically.
[isabell@stardust ~]$

Set up your domain:

[isabell@stardust ~]$ uberspace web domain list
isabell.uber.space
[isabell@stardust ~]$

Installation

Install yarn globally:

[isabell@stardust ~]$ npm install yarn -g
[isabell@stardust ~]$

Clone the GitHub repository and install the dependencies:

[isabell@stardust ~]$ git clone https://github.com/electerious/Ackee
[isabell@stardust ~]$ cd Ackee
[isabell@stardust Ackee]$ yarn

Configuration

Ackee Config

Create a new, empty .env file in the root of the Ackee directory. Add the following content, replacing the placeholders. The environment variables ACKEE_USERNAME and ACKEE_PASSWORD define the credentials to log into the web interface. If you want to use Ackee to analyze a domain other than isabell.uber.space, you have to add it under ACKEE_ALLOW_ORIGIN (read more about the CORS headers in the Ackee documentation).

ACKEE_MONGODB=mongodb://<admin>_mongoroot:<password>@localhost:27017/admin
ACKEE_USERNAME=<ackee_username>
ACKEE_PASSWORD=<ackee_password>
ACKEE_ALLOW_ORIGIN="https://isabell.uber.space"

Note

If you want to allow multiple sites, you can add them to ACKEE_ALLOW_ORIGIN separated by a comma (e.g. ACKEE_ALLOW_ORIGIN="https://isabell.uber.space,https://my-other-domain.de").

Web Backend Config

Note

Ackee is running on port 3000.

To make the application accessible from the outside, configure a web backend:

[isabell@stardust ~]$ uberspace web backend set / --http --port <port>
Set backend for / to port <port>; please make sure something is listening!
You can always check the status of your backend using "uberspace web backend list".
[isabell@stardust ~]$

Supervisord Daemon Setup

Create ~/etc/services.d/ackee.ini with the following content:

[program:ackee]
directory=%(ENV_HOME)s/Ackee
command=yarn start
autostart=yes
autorestart=yes
startsecs=30

After creating the configuration, tell supervisord to refresh its configuration and start the service:

[isabell@stardust ~]$ supervisorctl reread
SERVICE: available
[isabell@stardust ~]$ supervisorctl update
SERVICE: added process group
[isabell@stardust ~]$ supervisorctl status
SERVICE                            RUNNING   pid 26020, uptime 0:03:14
[isabell@stardust ~]$

Set a link to the log file destination so you can more easily access the logs:

[isabell@stardust html]$ ln --symbolic ~/.npm/_logs/ ~/logs/npm/
[isabell@stardust html]$

Finishing installation

Go to https://isabell.uber.space. Login using the credentials defined in section Ackee Config. Add the domains you want to analyze in the web interface: After adding, it shows a tracking snippet you can add to these pages. If data does not show up after implementing the tracking script, remember that cross site tracking always takes extra consideration of CORS.

Updates

Update by running git pull in Ackee’s directory, updating its dependencies with yarn and restarting the service with supervisorctl restart ackee.


Tested on Uberspace v7.11.1.1 with NodeJS v14, Ackee v3.0.6 and MongoDB v4.4.

Written by: tobimori <tobias@moeritz.cc>, Felix Förtsch <https://felixfoertsch.de>