Matomo is a Google Analytics alternative for tracking metrics on your websites. If you follow my blog, you know how easy it is to deploy popular Open Source web solutions like WordPress, Joomla!, Drupal, Moodle, and Magento on Oracle Cloud Infrastructure (OCI).
All these solutions are using MySQL Database Service to store their data.
I’ve recently added a new stack to deploy Matomo. Of course, this can be a standalone installation to collect all your analytics from self-hosted websites, but today I’ll describe how to use it with an existing stack we’ve already deployed on OCI.
For this example, I deployed WordPress using the following stack: oci-wordpress-mds.
The first step is to deploy Matomo on OCI.
In the second screen of the Stack’s wizard, we specify that we want to use an existing infrastructure. This way we won’t need to recreate our VCN, subnets, security lists, Internet Gateway, etc. — we want share what we’ve already deployed for WordPress:
As you can see for the majority of the input fields, we need to provide the OCID. These can be found on the OCI’s dashboard. For example the OCID for the MySQL Database can be found here:
We do this for every resources we want to reuse.
Then we create an apply job for the stack and when done we can get the public IP and other necessary information in the output section:
We can then enter the public IP in a browser and finish the installation:
It’s important to use the right connector/adapter: MYSQLI.
Then we follow the wizard and enter the required information.
When done, we can add our WordPress in Matomo to start tracking it. The first step is the retrieve its name (in our case, its public IP as I don’t use DNS):
We copy that code and we go into the admin dashboard of our WordPress site to modify the theme and add the previous code in the header file:
And this is all we needed to be able to get analytics of our website we deployed on OCI.