Worried about privacy compliance? Own your data! – Self host Matomo

Introduction

Ethical digital marketing practices have been a hot topic of discussion in recent years and state level legal compliance have further given fuel to the fire. However, as the general understanding of privacy and owning your own data whether personal or marketing has become more and more important and somewhat (almost) necessary. Marketing (hush tracking and limitless third party data) has to evolve in order to facilitate the ever growing concerns of invasive practices which have been going on for years without any repercussions.

In order to address this, we are going to look at how we can collect non personal yet quite useful analytics data. More importantly, this is the data that you own and govern and more importantly not share with third party. Matomo is one of the handful of analytics and measurement solutions where you can collect and process the data, in line with ethical marketing practices and legal compliance that enforces it. With the intro out of the way let’s get hands on with implementing Matomo’s On-premise (Self hosted solution). PS: at this stage we are not going to invest time and effort to address the efficacy of this data for your marketing needs. Perhaps that deserves another post.

Prerequisites


1) A web server. More or less same where you host your website but obviously it can be another server where you don’t host your site either. Ensure that these servers reside (hosted) in the country/Geographical area of data/privacy compliance, if in future you intend to collect first party and or personal data.
2) Access to FTP or shell to access the server in step 1.
3) A FTP client (to remote server)
4) Optional – WordPress Matomo plugin if your site’s primary server is WordPress.

Minimum requirements

Check that your web host meets the minimum requirements for self hosting Matomo.

Installation

1) Some web host allow one-click installation of on-premise Matomo. However, in this guide we assume that´s not the case.
2) Unzip the file on your local machine
3) Upload the unzipped Matomo files in binary format to desired location on your server via FTP. If you are planning to self-host it on the same server where you have your website, consider either subdomain or sub directory approach (https://analytics.example.com/) or (https://www.example.com/analytics). Either are fine.
4) Create a database on your web server.

Quick installation


Once you have uploaded Matomo to your web host, time to install it.
1) Navigate to the path where you uploaded the Matomo files. If everything was uploaded correctly, you will see Matomo installation welcome screen.
2) Hit next button to start the installation
a) System check – Everything here should be green. In case there are some errors, you might want to fix those.
b) Database setup – Enter the database details you created in the installation phase.
c) Create tables – This is done automatically
d) Super user login – Be careful to create a strong superuser login
e) Enter website details
f) Javascript tracking setup – You can either directly install the JS tracking code in the head section of the site’s HTML. Or you can push it via a tag manager. Alternatively if you are using a wordpress site (or these CMS – Link), you can install the plugin and let it handle the script
g) Click nex to finish the installation.

I have a wordpress site so I used the wordpress plugin (link) to manage the JS for me.