Automatically create view with script?

Very broad question, I know, but I need to be pointed in a general direction since I’m not a developer and I’ve never set-up a Matomo account from scratch:

We have a client and he has a website where other companies can offer their products. The moment he has a new provider, this provider gets access to a part of the shop with its own URL. For example: the default URL is www.abc.com. A provider registers and receives www.xyz.com, which is essentially a copy of the default website only with a selection of products. All these products are also available on the default website but that’s not what the question is about.

For this provider, a view is now created manually in Google Analytics with a filter on the URL, so that our customer can create reports. Therefor the property ID is the same.

My question is: To what extent is it possible with Matomo to automatically create something like a view for this new provider. For example: Is it possible to create a script which creates a view in Matomo and sets up Tag Manager.

Hi Dirk,

I would track these different websites in different sites in Matomo. You can use the API of Matomo to create a new website in Matomo programmaticaly. This new site will have a certain id, called idSite. Unless there’s a lot of custom tracking you want to implement the only thing you need on each website is the standard tracking code with the correct value for idSite in the line:
_paq.push([‘setSiteId’, {$IDSITE}]);
So replace {$IDSITE} with the correct number for that site that you get when creating a new site to track in Matomo.

That way you can give each customer their own login and have complete control over which site they can see. There doesn’t seem to be a similar thing as views in GA where you could add users to only a certain view, in Matomo the level of acces control is an entire tracked website.