Matomo can track a website within an iframe out of the box just like any other website. In some browsers there may be issues when cookies are enabled (Matomo might create a new visit on every page view). To make cookies work it is recommended to add the following snippet to your tracking code:

_paq.push(['setCookieSameSite', 'None']);

Please note that this requires your traffic to be on HTTPS. If you have mixed traffic on HTTP and HTTPS it might lead to duplicate or incomplete visits.

This feature requires Matomo 4 or newer.

Previous FAQ: How do I enable third party tracking cookies, as well as the existing first party cookies?