For example when you have a website with a URL of « example.com », by default Matomo (Piwik) will track all requests for this website, even those requests for Page URLs that do not belong to « example.com ». If you add the JavaScript tracking code on pages of « another-website.com », these requests will be tracked in your website « example.com » in Matomo.

It is possible to configure your website in Matomo so that only requests to « example.com » will be tracked, and all other requests ignored. Go to ⚙️ (Administration) > Measurables (Websites) > Manage > click « Edit ». Below the « URLs » field for your website, there is a checkbox « Only track visits and actions when the action URL starts with one of the above URLs. ». If you click this checkbox, and click « Save », Matomo will then only track requests where the domain and the path is an exact match of one of the URLs you 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.

Previous FAQ: How do I exclude traffic from an IP or a range of IP addresses?