How does Matomo work on Clever Cloud ?

How matomo works on Clever Cloud
In a previous post, we explained why you should switch from Google Analytics to Matomo for your audience measurement.

In a previous post, we explained why you should switch from Google Analytics to Matomo for your audience measurement. Some of our customers have decided to take this step, and Clever Cloud has helped them get to grips with the solution. Based on this experience, find out in this article how to maximize the use of our Matomo addon on Clever Cloud.

Selecting the optimal instance size

As soon as the Matomo addon is created, Clever Cloud deploys three optimized instances (a PHP runtime, a MySQL addon and a Redis addon). Initially, they are sized to the minimum server requirements in order to evolve according to your needs, thus ensuring cost optimization. If you need to make adjustments (for example, if you start to experience errors or slowdowns when launching some processes), our integrated Grafana is your best ally for monitoring your metrics and adjusting your resources accordingly.

Easy access to your metrics

Thanks to the intuitive dashboard for each application, you’re provided with a clear view of it all. We’ve recently integrated a metrics tile into this dashboard, allowing you to track RAM and CPU consumption in real time from the console.

Tile metrics from app Overview panel indicating CPU and RAM usage.

For a more in-depth analysis, a simple click on the Grafana logo from the tile gives you access to all your application’s metrics.

Metrics dashboard on Grafana for Matomo PHP application

In addition, Matomo’s PHP instance logs are always there to provide you with additional information.

All about auto-scalability

Self-scalability on Clever Cloud is a major advantage, giving you peace of mind and flexible billing. With Matomo, this feature guarantees a smooth experience even in times of high demand. Keep in mind certain specifics, such as the occasional need for certain extensions, and you’ll you make the most of this feature.

Perks from enabling auto-scalability on the PHP instance

With auto-scalability, you can use Matomo smoothly and adaptively, even during peak periods! Benefit from powerful on-demand resources, while paying only for the consumption/second. Once you’ve completed your intensive tasks, your instance returns to an optimal size, guaranteeing efficiency and savings. So there’s no need to reserve a large infrastructure to meet occasional needs.

When to disable auto-scalability?

Clever Cloud provides a service that can be adapted to your needs, with the option of limiting or completely disabling instance auto-scalability. In some cases, it may be advisable to deactivate it from time to time.

As Matomo is a managed service, some configuration options are unalterable to guarantee optimal operation and performance. As part of Matomo’s continuous improvement, we have integrated the Google Analytics data import extension in response to common customer requests. This extension, generally used for a one-off migration from Google Analytics to Matomo, is deactivated by default.

If you activate the extension and start importing data, and your application scales, your instance reboots and redeploys the application… with the default configurations. Restarting will therefore disable this extension and kill the import process at the same time. If you decide to use an extension that appears as disabled by default in our Matomo, we recommend the following procedure:

  1. Disable auto-scalability for your Matomo PHP instance
  2. Increase the instance size until the process is complete
  3. Restart instance
  4. Once the instance has been redeployed, activate the extension in Matomo

Now you’re ready to use the extension, which will remain active until the next server restart.

Matomo, with its MySQL addon, is designed to grow with you. While the database is created with sufficient capacity at start-up, Matomo will quickly exploit its potential. To avoid surprises, why not set up Grafana alerts to monitor memory levels?

Database metrics on Grafana
Your database metrics are also available in Grafana, in the Addon panel.

Creating alerts

Among its many features, Grafana lets you create alerts on the metrics of your choice. You’ll find a tutorial here to show you how to create your alerts from Grafana to Slack, which you can also apply to other contact points like Discord, Teams, etc.

We recommend that you leave around 20% disk space available, as the MySQL instance will need disk to migrate.

Migrating the database

Although scalability has its peculiarities for databases, Clever Cloud provides a smooth and intuitive manual solution. When you receive the alert, a simple connection to the Console on your MySQL addon dashboard will enable you to launch our one-click migration tool. This operation can take from a few seconds to a few minutes, depending on the size of your database.

💡 Tip: Include a direct link to the migration tab in your Grafana alert message. This will give you instant access to the migration tool, making the process even easier.

Leveraging Matomo and Clever Cloud

Although a managed service is pre-configured, you have Matomo administrator status and can use it as such. Here are just a few examples of what you can do with Matomo and Clever Cloud.

Adding new Matomo users

All our managed services use Clever Cloud SSO, enabling you to access deployed addons from your platform credentials. Perhaps you’d like to add users to Matomo without giving them access to the platform.

Matomo lets you add users with different levels of permissions to the application. You can invite them by email directly from the Matomo interface. Users invited by this method will not have access to Matomo’s system settings or extensions, unlike Clever Cloud users.

Elevating permission levels

If you have added a user from the Matomo interface, but now wish to add them to your Clever Cloud organization with the same email address, access to Matomo will be denied for security reasons, since this user already exists in the database.

To avoid duplication, simply delete the Matomo user from your database.

  1. Launch your MySQL addon’s PHPMyAdmin interface
  2. Click on your database name (not schema)
  3. Search by keyword user and choose the table matomo_user
  4. Delete the user you wish to add to the Clever Cloud organization
PHPMyAdmin Structure tab showing matomo_user table

Now you can invite the user to your organization with his email address, giving him administration rights on the instance.

Measure the audience of any application

On Clever Cloud, you can separate your collaborative environments by creating organizations to which you invite members. Organizations remain isolated, ensuring that no member has uninvited access to an organization’s applications and addons.

Matomo makes it possible to track apps to which a simple script has been added to the head. So, even if an application is deployed within a different organization, Matomo offers a unified and complete view of its audience tracking as soon as the application contains this script.

Matomo tracking code from its interface

Optimizing role separation

You can set up a dedicated organization for the Matomo administrator of your company or association. From this organization, the administrator can monitor the audience of applications hosted in other organizations, even if these are inaccessible to him/her.

To implement this configuration, the administrator simply provides the appropriate script to be integrated into the head tag of each application. Once integrated, the tracking data will be visible in Matomo. This process ensures that developers have no access to Matomo, while restricting the Matomo administrator’s access to applications.

📢 New: Migrate Google Analytics data to Matomo

As we mentioned, you can now use the extension to migrate your Google Analytics data to Matomo. It might be challenging to determine the right database sizing , due to Google Analytics’ opacity regarding its metrics.

With this in mind, we suggest you keep an eye on your database metrics and opt for a gradual increase in storage capacity. To facilitate this procedure, Matomo provides a detailed guide to migration.

Conclusion

Clever Cloud not only facilitates the deployment of on-demand applications and services in the form of add-ons. In addition, we include an integrated suite for all our customers, offering in-depth monitoring of application and database activity, as well as automatic and adaptive scaling capabilities.

Whether you’ve opted for Matomo or one of our other add-ons, we’re always listening to our customers’ needs, so we can continually improve the services we offer. We look forward to hearing from you!

Blog

À lire également

MateriaDB KV, Functions: discover the future of Clever Cloud at Devoxx Paris 2024

Clever Cloud is proud to present its new range of serverless products: Materia!
Company

Our new logs interface is available in public beta

You can now discover our new log stack interface and its new features!
Company

Deploy from GitLab or GitHub

Over the past few months, some customers have raised questions about CI/CD building to deploy…

Engineering