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.