- Do you want to use a privacy-friendly web analytics solution?
- Do you want to learn how to host your own web analytics platform on a cloud server in minutes?
If you answered ‘Yes!’ to either of these questions, then you’re in the right place.
Matomo is a free and open source web analytics platform that gives you insights into your website’s visitors, behavior, and conversions. In this post, we will show you how to host Matomo analytics on a RunCloud server and enjoy the benefits of a fast, secure, and scalable web analytics solution.
Sounds amazing, right?
Well, it is. And the best part is – you can do all this in next to no time. All you need is a RunCloud account, a Matomo account, and a few minutes of your time.
Let’s use those few minutes now to get you up and running!
Step 1: Create An Empty Web Application On RunCloud
The first step is to create an empty web application on RunCloud that will host your Matomo analytics app. Log in to your RunCloud dashboard and click on “Deploy a new web app”, switch to the “Empty Web App” tab, and then create an application with the default settings.
After that, you can configure the web server settings, such as domain name, SSL certificate, PHP version, etc. Once you’ve created your web application, you will see the dashboard with information about it, such as web root, database, etc.
Step 2: Log In To Your RunCloud Server Via SSH
The next step is to log in to your RunCloud server via SSH and download and extract the Matomo files. You can use any SSH client, such as PuTTY, Terminal, etc.
Once you log in to your server, you can use the following commands to download and extract the Matomo files:
cd /path/to/your/web/root # to change the directory to your web root
wget https://builds.matomo.org/matomo.zip # to download the Matomo zip file
unzip matomo.zip # to unzip the Matomo zip file
rm ./index.html 'How to install Matomo.html'matomo.zip # to delete the Matomo zip file
mv ./matomo/* . # to move files
In the above screenshot, we can see that the required files were extracted in the web application folder.
Step 3: Create A Database And A Database User On RunCloud
The third step is to create a database and a database user on RunCloud for your Matomo analytics. You can do this by following these steps:
- Go to your RunCloud web application dashboard and click on the Database tab.
- On the ‘User’ tab, click on the “Create Database User “button and enter the database username and password, such as matomo_user and matomo_pass.
- On the ‘Database’ tab, click on the “Create Database” button and enter the database name, such as matomo and select the user that we just created to grant all privileges to the database user.
- Click on the “Create Database” button.
Optionally, you might want to set Database collations if you are working with non-ASCII characters.
After creating the database, save these credentials, as we will need them when installing Matomo Analytics.
Step 4: Launch The Matomo Analytics Installation
The final step is to visit your web application and follow the Matomo installation instructions. You can do this by following these steps:
- Go to your web browser and enter the URL of your web application, such as https://example.com. You can also find this URL in the RunCloud dashboard for the web application that we created in step 1.
- When you visit this URL for the first time, you will see the Matomo installation wizard that will guide you through the installation process.
- Matomo needs some PHP functions that are disabled by default on RunCloud for enhanced security. To make sure installation goes smoothly, go to your RunCloud dashboard and enable the shell_exec PHP function.
- To do this, just remove the
shell_exec
, from the given list of disabled functions (see screenshot below). Make sure to remove the trailing comma and then save the configuration file.
- Now go back to the installation wizard. On the system check screen you should only see green check marks:
- Click ‘Next’, which will take you to the database page. Here you will need to enter the credentials that you saved earlier. Leave the database server as default, and modify the table prefix to any prefix you want.
- On the next page, you will need to configure the first website that you want to track using Matomo. Just enter the website name, your website URL, and configure the other settings if you like.
- Next, you will need to configure your login credentials for the Matomo dashboard. We recommend using a password manager to create a strong and unique password. You will also need to accept both the terms and conditions and the privacy policy of Matomo.
- Finally, you will then see a confirmation page that will show you the tracking code that you need to add to your website to start tracking your visitors. Copy this code and hit ‘Next’.
That’s it! You have successfully hosted Matomo analytics on a RunCloud server.
You can now log in to your Matomo dashboard and see the analytics data of your website. You can also customize your Matomo settings, such as adding more websites, creating goals, segments, reports, etc.
Step 5: Configure A Cron Job On RunCloud (Optional)
If you have a high traffic website, you may want to configure a cron job on RunCloud to run the Matomo archiving process periodically. This will improve the performance and accuracy of your Matomo reports.
You can do this by following these steps:
- Go to your RunCloud server dashboard and click on the Cron Job tab.
- Click on the Create Cron Job button and enter the following information:
- Job Label: matomo_reports (or any label you want)
- User: runcloud (or the user that owns your web application)
- Vendor Binary: Select the PHP version of your web application
- Command:
/path/to/matomo/console core:archive --url=http://example.com > /dev/null
(replaceexample.com
with your web application URL and/path/to/matomo
with the root path of your application as shown in RunCloud dashboard in step 1) - Run In: Every hour (or any frequency you want)
Click on the Create Cron Job button.
After creating the job, it should look something like the screenshot shown above.
Once your cron job is up and running, you can turn off automatic archiving in Matomo. To do this, open your Matomo dashboard and navigate to Settings > System > General Settings > Archiving settings and select ‘No’. Don’t forget to hit ‘Save’ after you’re done.
That’s it! You have successfully configured a cron job on RunCloud to run the Matomo archiving process every hour. You can check the log file to see the output of the cron job, and you can also modify or delete the cron job anytime from the RunCloud dashboard.
Final Thoughts
In this post, we have learned how to host Matomo analytics on a RunCloud server. Matomo is a powerful and flexible web analytics platform that gives you full control over your data and privacy. RunCloud makes it easy and fast to deploy, configure, and manage your web applications.
By using RunCloud with Matomo, you can benefit from the following features:
- Easy installation: You can install Matomo on your RunCloud server in just a few steps, without any technical hassle.
- Automatic backups: You can set up backups on your RunCloud server to protect your Matomo data from any loss or damage.
- Customizable settings: You can customize your application settings, such as adding more URLs, creating firewall rules, deploying SSL certificates, view access logs, etc.
If you are looking for a managed web hosting solution that is easy to install, fast to deploy, and secure to use, then you should try RunCloud. You will be amazed by how much RunCloud simplifies the installation process and enhances the performance of your web applications.
Sign up to RunCloud today and see the difference for yourself! 😊