If you have a site hosted on WordPress.com with a Free, Personal or Premium plan, then you can’t use plugins or add JavaScript code. With Matomo you can still enable tracking in that case, using the Matomo Image Beacon. This is very easy, and will only take a few steps.

Note: the Matomo Image Beacon does not use Javascript and is not able to create first party cookies, so Matomo will not be able to track some user information (learn more). To track with Javascript on a website hosted on WordPress.com you will need to upgrade to the Business, Commerce or Enterprise plan, or host the website yourself.

Steps to install the Matomo Image Beacon on your WordPress.com hosted website:

1. Log in to your WordPress site as the administrator.

2. In the left go to Appearances, and click on Editor.

3. Select the Header of your page.

4. On the top right, click on the menu (3 dots) and click on Code editor.

5. In between any 2 sections, paste the following code:

    <!-- Matomo Image Tracker -->
    <img src="https://matomo.example.org/matomo.php?idsite={$IDSITE}&amp;rec=1" style="border:0" alt="" />
    <!-- End Matomo -->

6. Replace https://analytics.example.com with your Matomo URL, for example https://mysite.matomo.cloud. It should now look like this:

7. Replace {$IDSITE} with your Matomo website ID, for example 1. It should now look like this:

8. Click on the “Save” button on the top right of your screen.

9. Click on the second “Save” button to confirm the changes.

Congratulations, you should now be successfully tracking visitors with Matomo Analytics through your WordPress site! Happy Analytics.

For more advanced configuration, the following parameters can also be passed to the image URL:

  • action_name – Defines the custom Page Title for this page view
  • urlref – The Referrer URL: must be set to the referrer URL used before landing on the page containing the Image tracker. For example, in PHP this value is accessible via $_SERVER['HTTP_REFERER']
  • idgoal – The request will trigger the given Goal
  • revenue – Used with idgoal, defines the custom revenue for this conversion
  • bots – Set &bots=1 to track all requests to the tracking image, including from bots and robots
  • and more! – There are many more parameters you can set beyond the main ones above. See the Tracking API documentation page.