Fathom web analytics may be just what you want if you need a self-hosted analytics platform. It’s a great alternative to Google Analytics and other platforms available today because it’s simple, transparent, open source, and 100% free to use without limits.
Fathom is an open-source analytics platform with a simple web interface. It provides full website analytics for small and medium-sized businesses.
When you want to take complete control of your website analytics and data without using third-party solutions like Google Analytics, then Fathom is a great place to start.
Fathom may be the only web analytics that gives you complete control over your data and more:
- Free, open-source software
- 100% data ownership
- User privacy protection
- User-centric insights
- Customizable and extensible
- Easy to use
- No data limits
This brief tutorial will show students and new users how to install Fathom on Ubuntu 16.04 and 18.04.
For more on Fathom, please visit its home page to set up Fathom; follow the steps below:
Install MariaDB Database Server
MariaDB database server is a great place to start when looking at open-source database servers for Magento. To install MariaDB run the commands below.
sudo apt update sudo apt-get install mariadb-server mariadb-client
After installing MariaDB, the commands below can stop, start and enable the MariaDB service to start up when the server boots.
Run these on Ubuntu 16.04 LTS
sudo systemctl stop mysql.service sudo systemctl start mysql.service sudo systemctl enable mysql.service
Run these on Ubuntu 17.10 and 18.04 LTS
sudo systemctl stop mariadb.service sudo systemctl start mariadb.service sudo systemctl enable mariadb.service
After that, run the commands below to secure the MariaDB server by creating a root password and disallowing remote root access.
sudo mysql_secure_installation
When prompted, answer the questions below by following the guide.
- Enter current password for root (enter for none): Just press the Enter
- Set root password? [Y/n]: Y
- New password: Enter password
- Re-enter new password: Repeat password
- Remove anonymous users? [Y/n]: Y
- Disallow root login remotely? [Y/n]: Y
- Remove test database and access to it? [Y/n]: Y
- Reload privilege tables now? [Y/n]: Y
Restart MariaDB server
Once you’ve installed all of Fathom’s required packages, continue below to start configuring the servers. First, run the commands below to create a blank Magento database.
To log on to the MariaDB database server, run the commands below.
sudo mysql -u root -p
Then create a database called Fathom.
CREATE DATABASE fathom;
Create a database user called Fathom user with a new password
CREATE USER 'fathomuser'@'localhost' IDENTIFIED BY 'new_password_here';
Then grant the user full access to the database.
GRANT ALL ON fathom.* TO 'fathomuser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;
Finally, save your changes and exit.
FLUSH PRIVILEGES; EXIT;
Download Fathom Script
One can use Fathom Analytics simply by downloading its install script on a Linux machine. To do that, run the commands below:
cd /tmp wget https://github.com/usefathom/fathom/releases/download/latest/fathom-linux-amd64 -O fathom
After downloading the script, run the commands below to make it executable and move it to the bin directory.
sudo chmod +x fathom
Then move it to the default local bin directory.
sudo mv fathom /usr/local/bin
That should allow you to use Fathom on Linux systems, including Ubuntu.
Setting Up Fathom
Before you can use Fathom, you must first create an account. Run the commands below to create an account via its web portal.
fathom register --email=[email protected] --password=new_password_here
That should create an account for the admin account.
All configuration in Fathom is optional. However, if you supply no configuration values, Fathom will default to using an SQLite database in the current working directory.
You most likely want to use MySQL or PostgreSQL if you plan on running Fathom for extended periods.
To do so, create a .env file in the working directory of your Fathom application or point Fathom to your configuration file by specifying the –config flag when starting Fathom.
Run the commands below to create the Fathom environment configuration file in your home directory.
cd nano .env
Then copy and paste the content below, replacing the database name and password you created above.
FATHOM_SERVER_ADDR=9000 FATHOM_DEBUG=true FATHOM_DATABASE_DRIVER="mysql" FATHOM_DATABASE_NAME="fathom" FATHOM_DATABASE_USER="fathomuser" FATHOM_DATABASE_PASSWORD="new_password_here" FATHOM_DATABASE_HOST="localhost" FATHOM_DATABASE_SSLMODE="" FATHOM_SECRET="random-secret-string"
Save your changes and continue.
Once you’ve configured the settings above, run the commands below to start the Fathom server.
fathom server
That should start up the server and begin listening on port 9000.
INFO[0000] Fathom 1.0.1
INFO[0000] Configuration file: /home/richard/.env
INFO[0000] Connected to mysql database: fathomuser:new_password_here@tcp(localhost)/fathom?loc=Local&parseTime=true
INFO[0001] Applied 4 database migrations!
INFO[0001] Server is now listening on :9000
Now open your browser and browse to the server hostname or IP address followed by port #9000

Create a system service account to ensure Fathom starts automatically when you boot your server.
Run the commands below to create one for Fathom.
sudo nano /etc/systemd/system/fathom.service
Then add the content below to the file and save it.
[Unit] Description=Fathom server management service unit Requires=network.target After=network.target [Service] Type=simple User=richard Restart=always RestartSec=3 WorkingDirectory=/home/richard ExecStart=/usr/local/bin/fathom server [Install] WantedBy=multi-user.target
Save the file and exit.
After that, run the commands below to enable the Fathom service.
sudo systemctl daemon-reload sudo systemctl enable fathom.service
This is the code you’ll want to add to your web pages if you want to gather information about your website.
<!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->
<script>
(function(f, a, t, h, o, m){
a[h]=a[h]||function(){
(a[h].q=a[h].q||[]).push(arguments)
};
o=f.createElement('script'),
m=f.getElementsByTagName('script')[0];
o.async=1; o.src=t; o.id='fathom-script';
m.parentNode.insertBefore(o,m)
})(document, window, '//yourfathom.com/tracker.js', 'fathom');
fathom('trackPageview');
</script>
<!-- / Fathom -->
For more on configuring Fathom, check out its GitHub page.
Enjoy!
You may also like the post below:
Leave a Reply