Tracking across site and spa's on subdomains

We use matomo on our external site and want to set it up with our apps that run on subdomains of our main site.

Our external/main site is running webflow, and is tracking fine with javascript-snippit that we got form matomo.

Our apps are React apps and are using the react-piwik library to pickup page changes and track them.

Our site and apps are setup as seperate sites in matomo.
Everything is tracking fine seperatly, but the users don’t get track across so they have 2 different user-id’s.

We set the following variables on startup on both the site and the apps.

ReactPiwik.push(['setDomains', '*.ourdomain.com']);
ReactPiwik.push(['setCookieDomain', '*.ourdomain.com']);

Are there additional settings that need to be set, or should these be set on every track view call?

Thanks for help in advance.