How do I force Matomo to only track Page URLs that belong to my website?
By default, if your Matomo website is set up for example.com
, it will track all requests sent with that site ID, even if the tracked page isn’t actually on example.com
. For example, if you place the Matomo JavaScript tracking code on pages of another-website.com
, those visits will still be recorded under the example.com
site in Matomo.
You can configure your website in Matomo so only requests to your website will be tracked, and all other requests will be ignored.
- Go to Matomo settings
> Measurables (Websites) > Manage.
- Click Edit to configure the site’s settings.
- Below the URLs field, select the checkbox, Only track visits and actions when the action URL starts with one of the above URLs.
- Click Save to update the settings.
By enabling this setting, Matomo will only track requests where the domain and the path is an exact match of the URLs specified for this website. This means each valid subdomain has to be specified separately. For example, when the known URLs are ‘http://example.com/path’ and ‘http://good.example.com’, tracking requests for ‘http://example.com/otherpath’ and ‘http://bad.example.com’ are ignored.