Tracking data by account and web property?

Hello,
I develop for a SAAS application that has about 50k active accounts. Each account can have multiple web properties (microsites) that I want to track individually.

I’m experimenting with the Matomo api to see how I can best track and report each microsite per account.

My current plan is to create a new Site_Id for each account, and use a custom dimension to uniquely track each microsite within that site_id.

I’m thinking that way if an account cancels I can clean their tracking by deleting their site_id.

Also, it seems this structure would let me create a userLogin per siteId (account_id on my side) and then a token_auth for each userLogin so I can give access to widget reports per account.

But it does mean I’ll end up creating thousands of sites so I’m wondering if this seems like a reasonable approach or if there’s a better way to track my our account microsites?
Thanks!

I think this would work if you use one custom dimension to identify the microsite…
For eample in my case, I use an “environment” dimension ti be able to know if the tracked site is test, UAT, production… And then I segment the dashboard by the environment dimension…
Then your visit custom dimension could be: micrositeID. Or micrositeBaseURL, and in this case, yo’ll be able to automate the tracking of new micro-site…

Thank you for the response Philippe! You’re right, using the custom dimension for my microsite_id seems like a good solution for being to track and report each microsite separately.

The other prong of my solution is to group all the tracking of for the microsites owned by one of my customer accounts. That is where I am assigning a new Site ID to each customer account. This is the part I’m more questionable on. It works, but it just means I will be creating many (thousands) of Sites in my matomo dashboard and not sure if there are pitfalls in doing that? But off the top it feels like a good way to create isolation in the tracking data between each of my customer accounts, and then if my customer leaves and deletes their account I can just delete their Site from the matomo server.

Thanks!
Ken