Matomo: Getting Started

Learn how to efficiently set up and use Matomo for your analytics needs.

👋 Welcome to the Stackhero documentation!

Stackhero offers a ready-to-use Matomo cloud solution that provides a host of benefits, including:

  • Unlimited websites, members, segments, goals, and data retention time.
  • Effortless updates with just a click.
  • Customizable domain name secured with HTTPS (for example, https://analytics.your-company.com).
  • Optimal performance and robust security powered by a private and dedicated VM.

Save time and simplify your life: it only takes 5 minutes to try Stackhero's Matomo cloud hosting solution!

Frequent visits to your own website can skew your analytics data. Fortunately, Matomo provides a simple way to exclude your IP address, ensuring your data remains accurate and insightful.

To get started, open your Matomo dashboard and navigate to Administration > Websites > Manage. Select the website you want to update, click the edit icon, and enter the IP addresses you wish to exclude in the Excluded IPs field.

You can exclude IPs for all websites managed in Matomo by navigating to Administration > Websites and selecting Settings.

Sometimes, URLs may contain sensitive information like tokens or email addresses. Matomo offers a feature to exclude this data, helping you maintain privacy and security.

Visit your Matomo dashboard, navigate to Administration > Websites > Manage, and select the website you want to update. Click the edit icon and input the parameters you want to exclude in the Excluded Parameters field.

For instance, adding token will remove the token parameter from a query like ?page=authorization&token=abcd.

Note that Excluded Parameters supports regular expressions as well!

Are you transitioning from Google Analytics to Matomo? You can transfer your historical data using Matomo's Google Analytics Importer plugin, making the shift seamless and preserving your valuable insights.

To begin, access your Matomo dashboard and navigate to Administration > Platform > Marketplace. Locate the "Google Analytics Importer" plugin and click Install. Once installed, it will be available under Administration > System > Google Analytics Import.

Next, link Matomo to your Google Analytics account. Detailed instructions are available here: Matomo's Google Analytics Importer Documentation.

Importing data creates a new website in Matomo. If you have already started collecting data, you will have two separate websites that cannot be merged. For more details, see this GitHub issue.

To avoid data duplication, consider following these steps:

  1. Begin the Google Analytics import to create a new website.
  2. Add the Matomo tracking code from the newly created website to your site.
  3. Simultaneously, remove the Google Analytics tracking code to prevent data duplication.
  4. Once the import is complete (which may take several days), remove the Google Analytics Importer plugin from Matomo.

Is your website a Single Page Application (SPA)? If you are using the Matomo JavaScript tracking client, you will need additional code to effectively track user actions.

Matomo provides comprehensive documentation on SPA tracking, available here: Matomo SPA Tracking Guide.

If your website is built with frameworks like React, Vue.js, or Gatsby, there might be a module available to simplify this process.

Enhance user tracking by associating requests with a user ID in Matomo. This step can help you gain deeper insights into user behaviour.

To set this up, define the user ID using the _paq.push([ "setUserId", "<userIdHere>" ]); code.

Keep in mind:

  • setUserId must be defined before trackPageView.
  • The User ID must be a string. Although Matomo will not log an error if you send integers, it will not display the corresponding user ID. Use userId.toString() if you need to convert an integer to a string.

For more details, refer to Matomo's JavaScript Tracking Guide.

Ensure compliance with relevant laws when associating user IDs with requests.

Matomo differentiates between pages like index.html and INDEX.html. If case sensitivity is not crucial for your site, you can normalize URLs by adding the following code to your Matomo JavaScript Tracking tag:

// Add this code:
_paq.push(['setCustomUrl', location.href.toLowerCase()]);
// Just before this line:
// _paq.push(['trackPageView']);

For additional guidance, check out the official Matomo FAQ.