Matomo Analytics, formerly Piwik Analytics, is one of the most popular Google Analytics alternatives available today. The open source web analytics suite has a long list of features and over 50 plugins available to customize user interaction and tracking and for your marketing and privacy needs.
The recommended shell_exec PHP function cannot be enabled on shared hosting. However, Matomo runs fine without it for most use cases.
Before, you’d need to install a stand-alone Matomo Analytics application on the web server with a dedicated database user and password for storing data. Then you’d have to embed the Matomo tracking code into your website header or footer to start logging interactions. Or you could add the tracking code and import some statistics in a content management system (CMS) dashboard such as:
Then, in 2019, the Matomo developers created an official plugin to manage analytics features from within the WordPress dashboard. Matomo Analytics – Ethical Stats. Powerful Insights grants you access to on-site web analytics functions without having to install a separate web application on the server. There are a few notable advantages to this:
- Analytics accessible with only 1 button click
- Less user credentials to maintain with password management
- Matomo privileges automatically mapped to WordPress administrator roles
- Easier maintenance as updates and other notifications are in one location
- Simpler migration process as all Matomo data is in the installed WordPress directory and database
Below we’ll cover how to:
- Install the Official Matomo Analytics WordPress Plugin
- Get Started with Matomo Analytics in WordPress
Per the Matomo developers, if you’re already using a standalone Matomo installation or Matomo Cloud, it’s best to use the WP-Matomo plugin which integrates your website with your existing Matomo data. Attempting to combine the two data sources could result in data corruption.
Install the Official Matomo Analytics WordPress Plugin
This plugin downloads the DBIP-City.mmdb geolocation database from DB IP into your uploads directory to detect user location based on their IP address.
Install from the Dashboard
- Log into your WordPress dashboard.
- Install the Matomo Analytics – Ethical Stats. Powerful Insights plugin and activate it.
- In the plugins list, under Matomo Analytics, select Get Started.
Install via WP-CLI
System administrators with WP-CLI installed can manage WordPress plugins with dedicated SSH commands.
- Connect to your server using SSH.
- Install and activate Matomo Analytics using the following command:
wp plugin install matomo --activate
WordPress developers without WP-CLI or using File Transfer Protocol (FTP) can manually upload the WordPress plugin before activating it in the dashboard.
- To install the plugin manually, download the plugin zip file from WordPress.org.
- Upload the zip file and extract the folder in the WordPress
- Log into your WordPress site or use the WP-CLI SSH command to activate the plugin:
wp plugin activate matomo
Get Started with Matomo Analytics in WordPress
This section will cover the basics of enabling and configuring the Matomo tracking code for WordPress.
- Log into your WordPress dashboard.
- On the left, hover over Matomo analytics and select Get Started.
- Select Enable tracking now.
- Purge any server caching (PHP-FPM or NGINX) or plugin caching (e.g. W3 Total Cache and WP Super Cache).
- Select Click here to configure your tracking code in the Settings section.
- On the Tracking page, you can configure or disable the tracking code for your WordPress website. Notable options worth reviewing:
Disable cookies for tracking visitors
Enable ecommerce for WordPress stores (e.g. WooCommerce)
Track search to learn more about what users are looking for within your website
Track 404 helps improve user experience (UX) and search engine optimization (SEO)
Enable content tracking for user engagement with advertisements, videos, and more
Track RSS feeds if you encourage readers to use Really Simple Syndication (RSS) readers
User ID Tracking for auditing registered users’ actions
Force Matomo to use a specific protocol to ensure your Matomo suite uses an SSL connection
- At the bottom, Save Changes.
Matomo Admin Access
At the top, select the Access tab to control which WordPress roles (editor, author, etc.) have assigned Matomo roles by default. The options are View, Write, and Admin. The Super User role is automatically assigned to the WordPress administrator. Once you’re done, don’t forget to Save changes.
Developers can also use WordPress role editor plugins for further flexibility with custom Matomo capabilities:
The Exclusions tab helps you clean up analytics by excluding the following from tracking:
- WordPress user roles
- IP addresses for proxy servers or specific networks
- Query URL parameters such as affiliate campaign links
- User agents, useful for ignoring some crawl bots
- Fragments (HTML anchors)
After any updates, Save changes.
Geolocation for Matomo Analytics
As mentioned earlier, Matomo uses DB-IP for IP geolocation in analytics. Users wanting more accurate location results in WordPress can create a MaxMind account. Then, add the MaxMind license key to your Geolocation settings. Save changes.
The Advanced tab is where you ensure Matomo knows which IP address is indeed yours. This is important when your website is behind a proxy server. If the detected IP is wrong, select the radio button for the correct option.
You may also deselect the Yes checkbox to prevent Matomo from deleting website analytics if the plugin is uninstalled. Save changes if necessary.
Once you’ve completed your Matomo setup, select Matomo Analytics > Reporting from the sidebar to access the Matomo dashboard.
You may need to whitelist the website if you’re using a web browser extension for ad blocking including uBlock Origin, Adblock, and NoScript.
The dashboard is very similar to the standalone Matomo web application dashboard. Click the gear icon in the upper-right corner to access Matomo dashboard settings including segmentation and automated email reports.
After you’ve gotten familiar with the Matomo dashboard, you should check out the other Matomo Analytics options in the WordPress sidebar:
- Summary for a snapshot of recent analytics
- Marketplace for installing Matomo plugins
- Diagnostics for possible website, database, or server issues
Learn more ways to enhance your website through our WordPress Education Channel.
Improve the performance and security of your WordPress website with our WordPress hosting plans.
Web Application Firewalls Free SSL Certificates Advanced Server Caching