Clicky

  1. Home
  2. How To
  3. How to add Matomo (Piwik) Analytics in AMP

How to add Matomo (Piwik) Analytics in AMP

Matomo, formerly Piwik, is a free and open-source web analytics application developed by a team of international developers, that runs on a PHP/MySQL webserver. It tracks online visits to one or more websites and displays reports on these visits for analysis.

Follow the below steps to add Matomo (Piwik) Analytics in AMP

Step 1 – Go to WordPress admin area -> AMP option panel -> Settings -> Analytics.

Step 2 – Matomo (Piwik) Analytics: Enable this option you need to enter the Matomo (Piwik) Analytics URL.

Step 3 – Enter Your Piwik Analytics URL: In this filed you need to enter your Piwik Analytics URL. for example:( https://YOUR_PIWIK_BASE_INSTALLATION_URL/piwik.php?idsite=1&rec=1& action_name=TITLE&urlref=DOCUMENT_REFERRER&url=CANONICAL_URL& rand=RANDOM )

Required parameters

  • Piwik base URL (required): Here you need to enter your Piwik base installation URL.
  • idsite (required) – The ID of the website we’re tracking a visit/action for.
  • rec (required) – Required for tracking, must be set to one, eg, &rec=1.
  • action_name (recommended) -The title of the action being tracked. It is possible to use slashes / to set one or several categories for this action. For example, Help / Feedback will create the Action Feedback in the category Help
  • urlref -The full HTTP Referrer URL. This value is used to determine how someone got to your website (ie, through a website, search engine or campaign)
  • url (recommended) -The full URL for the current action.
  • rand (recommended) – Meant to hold a random value that is generated before each request. Using it helps avoid the tracking request being cached by the browser or a proxy.

For Example: 

Step 4 – Click on the “Save Changes” button and it will be displayed on your AMP pages.

If you enable this option it Can be tracked the Browser, Operating System, Time on Website/Page, Page Title, IP/Hostname.

That’s it for this tutorial!

We hope it helped you. If you have any feedback or questions, then please share them in the comments section below.

 

Ask your Questions Directly!
If you can't find the solutions in this article, then just ask us in the comments and we will answer it for you!
Updated on September 2, 2022

    Are you still looking for a solution?

    Then fill out the below form and we will reach out to you within a few hours.


    Was this article helpful?

    Related Articles

    Comments

    1. Ho do I add the Tracking code from the matomo WP plugin to ampfor WP? I could not find anything on this page and the links above (7 month old) do not help as well. Unfortunately with the new data privacy laws non of the available tracking services can be used without showing a cookie banner 🙁

    2. How should the URL look like when using the Matomo Analytics wordpress plugin?

    3. When I use your Matomo integration, I get “Page URL not defined” in the Matomo statistics. Is there a solution that the URL is also handed over here?

    4. Hi,
      I’ve used Matomo for a long time and well versed on Matomo generator. I wasn’t sure if the queries are variables or are static.
      In your example
      https://YOUR_PIWIK_BASE_INSTALLATION_URL/piwik.php?idsite=1&rec=1& action_name=TITLE&urlref=DOCUMENT_REFERRER&url=CANONICAL_URL& rand=RANDOM

      The queries:
      action_name=TITLE
      urlref=DOCUMENT_REFERRER
      url=CANONICAL_URL
      url=RANDOM

      Do I need to change TITLE, DOCUMENT_REFERRER, etc.. or are these variables that WP-AMP will change depending on the page, referrer, etc?

      Please don’t respond by stating to contact AMP support at https://ampforwp.com/support. This is a general question and I think many users who use Matomo may want to know this.
      Thank you,

    Leave a Comment