Matomo Analytics Integration Plugin

With GDPR-compliance and privacy being hot-topics in the online world, Matomo Analytics seeks to offer users an alternative to tracking-heavy analytics solutions such as Google. With over 250 different settings to fine-tune your analytics, multiple data visualizations, and the option to use a full GDPR-compliant cookieless tracking mode, Matomo Analytics is a superb choice for users that want useful data without compromising privacy.

With this plugin, integrating Matomo Analytics into your Publii site is a cinch; no need to manually add code to your site, and GDPR-cookie banner compatibility allows visitors to easily provide consent to tracking cookies if required.

Setting Up Matomo

Before using the plugin, an account must be created with Matomo in order to receive the credentials required to activate the plugin, and to configure the analytical options to suit your site's needs. To create an account, follow these steps:

  1. Open your browser to Matamo's homepage and click on the Try Free Cloud Trial button in the header to be taken to the account creation screen.
  2. On the account creation screen, you will need to enter your email address and provide the URL for the website you wish to track. Once done, make sure to click the checkbox to accept the terms and conditions, then click the Start improving your websites now button to continue.
  3. An email will be sent by Matomo with a Matomo analytics domain for your site, plus a username and password that you will need to use to login to your account. Once you have received this email, you can proceed to the next step.
  4. On the next screen you will need to complete the account creation process; enter your Matomo Analytics domain as provided in the account creation email from the previous step, then click the Log in button. Keep a note of this domain as you will need to enter it into the Publii plugin settings later.
  5. A new login screen will open; here you will need to enter the Username and Password provided by Matomo in their confirmation email, the click the Log in button.
  6. Once logged-in, the first screen you will see will be to integrate the tracking code into your site. We don't need this information since the plugin will take care of it for us. Instead, click on the Integrations tab under the Choose your preferred way of setting up title to open the integration information section.
  7. From this section, make a note of the Matomo URL and site ID; we will need to enter this information into the plugin in Publii to allow your site to start tracking analytics. Your account is now setup and we can move to enabling and setting up the plugin.

Installing the Plugin

The Matomo Analytics plugin is not included in the standard Publii installation; in order to get access to the plugin, it will first need to be downloaded via the Publii Plugin Marketplace, then installed through the Publii app. To do so, follow these steps:

  1. Open Publii’s App Menu by clicking on the three dots icon in the top-right of the app UI; this icon is always visible except when creating or editing a new post, tag or menu.
  2. In the menu that appears, click on Plugins. This will take you to the Plugins page where you can see any plugins that you have installed.
  3. Click on the Get More Plugins box to open your browser at the Publii Plugins Marketplace, which displays all the currently available plugins.
  4. Click on the Matomo Analytics plugin box to open the description page. From here, you can click the Download button under the description to download the zipped install package.
  5. Once the download has finished, in the Plugins screen of the Publii app, click on the Install Plugin button at the top of the page. This will open your file explorer; browse to the folder where you downloaded the plugin file, and select it. Publii will automatically install the plugin and add it to the list of available plugins in both the Plugins and Tools & Plugins pages in Publii.

Activating the Plugin

The plugin can be enabled by clicking the switcher button in the Matomo Analytics box of the Tools & Plugins section of the Publii app. If the switcher changes from grey to blue. then the plugin is enabled. You will need to enter both your Matomo URL and Site ID into the plugin options before the plugin can function properly; to do so, open the Plugin Options screen by clicking anywhere in the Matomo Analytics box anywhere except on the switcher button; this will open the Plugin options screen, where you can add the necessary information. For the other options contained in this section, more details may be found in the next section of this guide.

Matomo Analytics Plugin Options

This plugin has two required settings, Matomo URL and Site ID, but it also includes options for integrating Matomo consent requests into the cookie banner. The options in the plugin are as follows:

Configuration

  • Matomo URL - Enter the Matomo URL as provided in the confirmation email sent by Matomo when creating an account, and also on the Integrations tab of the Matomo settings after logging-in on the Matomo website.
  • Site ID - Enter the Site ID as provided via the Integrations tab of the Matomo settings after logging-in on the Matomo website.
  • Output Code in Preview Mode - If enabled, the code used to provide tracking data to Matomo Analytics will be included when clicking the Preview your changes button in Publii. This is useful when debugging to ensure the code is generated correctly, but generally should be disabled to prevent incorrect data being included in your analytics.

Cookie Banner Integration

  • Cookie Banner Integration - Enabling this option will add an option to the built-in Publii cookie banner for users to consent to cookies from Matomo. Depending on your analytics settings in Matomo, cookies may or may not be required.
  • Cookie Group ID - This option only becomes available when the Cookie Banner Integration option is enabled. Here, you can specify the cookie group that the Matomo cookies should be added to. Make sure to add the group name to the GDPR section of the site settings. You can find instructions on how to do this in the GDPR section of this documentation.