Adds Matomo (former Piwik) statistics to your WordPress dashboard and is also able to add the Matomo Tracking Code to your blog.
If you are not yet using Matomo On-Premise, Matomo Cloud or hosting your own instance of Matomo, please use the Matomo for WordPress plugin.
This plugin uses the Matomo API to show your Matomo statistics in your WordPress dashboard. It’s also able to add the Matomo tracking code to your blog and to do some modifications to the tracking code. Additionally, WP-Matomo supports WordPress networks and manages multiple sites and their tracking codes.
To use this plugin the Matomo web analytics application is required. If you do not already have a Matomo setup (e.g., provided by your web hosting service), you have two simple options: use either a self-hosted Matomo or a cloud-hosted Matomo by InnoCraft.
Requirements: PHP 7.0 (or higher), WordPress 5.0 (or higher), Matomo 4.0 (or higher)
Languages: English, Albanian, Chinese, Dutch, French, German, Greek, Hungarian, Italian, Polish, Portuguese (Brazil). Partially supported: Azerbaijani, Belarusian, Hindi, Lithuanian, Luxembourgish, Norwegian, Persian, Romanian, Russian, Spanish, Swedish, Turkish, Ukrainian
You can use following shortcodes if activated:
[wp-piwik module="overview" title="" period="day" date="yesterday"]
Shows overview table like WP-Matomo’s overview dashboard. See Matomo API documentation on VisitsSummary.get to get more information on period and day. Multiple data arrays will be cumulated. If you fill the title attribute, its content will be shown in the table’s title.
[wp-piwik module="opt-out" language="en" width="100%" height="200px"]
Shows the Matomo opt-out Iframe. You can change the Iframe’s language by the language attribute (e.g. de for German language) and its width and height using the corresponding attributes.
[wp-piwik module="post" range="last30" key="sum_daily_nb_uniq_visitors"]
Shows the chosen keys value related to the current post. You can define a range (format: lastN, previousN or YYYY-MM-DD,YYYY-MM-DD) and the desired value’s key (e.g., sum_daily_nb_uniq_visitors, nb_visits or nb_hits – for details see Matomo’s API method Actions.getPageUrl using a range).
[wp-piwik]
is equal to [wp-piwik module=”overview” title=”” period=”day” date=”yesterday”].
Thank you all!
wp-piwik
directory into your wp-content/plugins
directory.There are two differents methods to use WP-Matomo in a multisite environment:
Site Specific Plugin
Just add WP-Matomo to your /wp-content/plugins folder and enable the Plugins page for individual site administrators. Each user has to enable and configure WP-Matomo on his own if he want to use the plugin.
Network Plugin
The Network Plugin support is still experimental. Please test it on your own (e.g. using a local copy of your WP multisite) before you use it in an user context.
Add WP-Matomo to your /wp-content/plugins folder and enable it as Network Plugin. Users can access their own statistics, site admins can access each blog’s statistics and the plugin’s configuration.
To use this plugin you will need your own Matomo instance. If you do not already have a Matomo setup, you have two simple options: use either a self-hosted Matomo or cloud-hosted Matomo by InnoCraft.
As soon as Matomo works, you’ll be able to configure WP-Matomo: The Matomo URL is the same URL you use to access your Matomo, e.g. for the demo site: http://demo.matomo.org. The auth token is some kind of a secret password, which allows WP-Matomo to get the necessary data from Matomo. To get your auth token, log in to Matomo, click at the preferences gear icon (top right) and click at “API” (left sidebar menu, near the bottom).
You can get a more detailed description here: https://matomo.org/blog/2015/05/wordpress-integration-wp-piwik-1-0/
First, please make sure your configuration is valid, e.g., if you are using the right Matomo URL (see description above). Then, go to the “Support” tab and run the test script. This test script will try to get some information from Matomo and shows the full response. Usually, the response output gives a clear hint what’s wrong:
The response output contains…
– bool(false) and HTTP/1.1 403 Forbidden: WP-Matomo is not allowed to connect to Matomo. Please check your Matomo server’s configuration. Maybe you are using a password protection via .htaccess or you are blocking requests from localhost/127.0.0.1. If you aren’t sure about this, please contact your web hoster for support.
– bool(false) and HTTP/1.1 404 Not Found: The Matomo URL is wrong. Try to copy & paste the URL you use to access Matomo itself via browser.
– bool(false) and no further HTTP response code: The Matomo server does not respond. Very often, this is caused by firewall or mod_security settings. Check your server logfiles to get further information. If you aren’t sure about this, please contact your web hoster for support.
If this does not help as well, feel free to open a topic in the support forum. Please share all available information including the test script result, if possible.
The Compatibility Checker shows two false positives. WP-Matomo is 100% PHP7 compatible, you can ignore the report.
See Matomo FAQ.
The Matomo API is limited to 100 sites by default. Add the following line to the section [General] of Matomo’s config/config.ini.php file:
API_datatable_default_limit = 1000
Try to enable the “avoid mod_security” option (WP-Matomo settings, Tracking tab) or create a mod_security whitelist.
You like to contribute to WP-Matomo translations? Please use the Transifex translation community.
Of course, I will add missing languages if requested, and I will also upload the existing language files of older WP-Matomo releases.
If you can’t (or don not want to) use transifex, you can also translate languages/wp-piwik.pot delivered with WP-Matomo.
Thank you very much! 🙂