{"id":7489,"date":"2019-04-20T08:30:32","date_gmt":"2019-04-20T08:30:32","guid":{"rendered":"https:\/\/ampforwp.com\/tutorials\/?post_type=ht_kb&#038;p=7489"},"modified":"2022-09-02T12:06:20","modified_gmt":"2022-09-02T12:06:20","slug":"how-to-add-matomo-piwik-analytics-in-amp","status":"publish","type":"ht_kb","link":"https:\/\/ampforwp.com\/tutorials\/article\/how-to-add-matomo-piwik-analytics-in-amp\/","title":{"rendered":"How to add Matomo (Piwik) Analytics in AMP"},"content":{"rendered":"\n<p>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. <\/p>\n\n\n\n<p><strong>Follow the below steps to add Matomo (Piwik) Analytics in AMP<\/strong><\/p>\n\n\n\n<p><strong>Step 1 &#8211;<\/strong> Go to <strong>WordPress admin area<\/strong>&nbsp;-&gt;&nbsp;<strong>AMP option panel<\/strong>&nbsp;-&gt;&nbsp;<strong>Settings<\/strong> -&gt; <strong>Analytics<\/strong>.<\/p>\n\n\n\n<p><strong>Step 2 &#8211;<\/strong> <strong>Matomo (Piwik) Analytics: <\/strong>Enable this option you need to enter the Matomo (Piwik) Analytics URL.<\/p>\n\n\n\n<p><strong>Step 3 &#8211; <\/strong> <strong>Enter Your Piwik Analytics URL:<\/strong> In this filed you need to enter your Piwik Analytics URL. for example:(  https:\/\/YOUR_PIWIK_BASE_INSTALLATION_URL\/piwik.php?idsite=1&amp;rec=1&amp; action_name=TITLE&amp;urlref=DOCUMENT_REFERRER&amp;url=CANONICAL_URL&amp; rand=RANDOM  )<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"480\" src=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/03\/20-1024x480.png\" alt=\"\" class=\"wp-image-16848\" srcset=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/03\/20-1024x480.png 1024w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/03\/20-300x141.png 300w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/03\/20-768x360.png 768w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/03\/20-50x23.png 50w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/03\/20-60x28.png 60w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/03\/20-100x47.png 100w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/03\/20.png 1308w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Required parameters<\/strong><\/p>\n\n\n\n<ul><li><strong>Piwik base URL<\/strong> (required): Here you need to enter your Piwik base installation  URL. <\/li><li><strong>idsite (required)<\/strong>&nbsp;&#8211; The ID of the website we&#8217;re tracking a visit\/action for.<\/li><li><strong>rec (required)<\/strong>&nbsp;&#8211; Required for tracking, must be set to one, eg, &amp;rec=1.<\/li><li><strong>action_name (recommended)<\/strong>&nbsp;-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<\/li><li><strong>urlref<\/strong>&nbsp;-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)<\/li><li><strong>url (recommended)<\/strong>&nbsp;-The full URL for the current action.<\/li><li><strong>rand (recommended)<\/strong>&nbsp;&#8211; 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.<\/li><\/ul>\n\n\n\n<p><strong>For Example:\u00a0<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"31\" src=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2022\/09\/Screenshot_7-1024x31.png\" alt=\"\" class=\"wp-image-18507\" srcset=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2022\/09\/Screenshot_7-1024x31.png 1024w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2022\/09\/Screenshot_7-300x9.png 300w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2022\/09\/Screenshot_7-768x23.png 768w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2022\/09\/Screenshot_7-50x2.png 50w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2022\/09\/Screenshot_7-60x2.png 60w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2022\/09\/Screenshot_7-100x3.png 100w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2022\/09\/Screenshot_7.png 1155w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Step 4 &#8211;<\/strong> Click on the &#8220;<strong>Save Changes<\/strong>&#8221; button and it will be displayed on your AMP pages.<\/p>\n\n\n\n<p>If you enable this option it Can be tracked the Browser, Operating System, Time on Website\/Page, Page Title, IP\/Hostname.<\/p>\n\n\n\n<p><strong>That\u2019s it for this tutorial!<\/strong><\/p>\n\n\n\n<p>We hope it helped you. If you have any feedback or questions, then please share them in the comments section below.<\/p>\n\n\n\n<p>&nbsp;<\/p>\n<div id=\"div-1\" class=\"hkb-feedback\">\n\t\t\t<strong class=\"ht-mobile-exit__title\">Ask your Questions Directly!<\/strong><br>\n\t\t\t<div class=\"hkb_widget_exit__content\" style=\"font-size: 14px;\">If you can't find the solutions in this article, then just ask us in the comments and we will answer it for you!<\/div>\n\t\t\t<a href=\"https:\/\/ampforwp.com\/support\/#contact\" id=\"button\" target=\"_blank\" rel=\"noopener noreferrer\"><button>Yes, I have a Question<\/button><\/a>\n\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>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&#8230;<\/p>\n","protected":false},"author":18,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":[],"ht-kb-category":[34],"ht-kb-tag":[],"_links":{"self":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/7489"}],"collection":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/comments?post=7489"}],"version-history":[{"count":54,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/7489\/revisions"}],"predecessor-version":[{"id":18508,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/7489\/revisions\/18508"}],"wp:attachment":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/media?parent=7489"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb-category?post=7489"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb-tag?post=7489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}