Bulk adding domains to self hosted motomo?

Hello guys,

First thank you for this wonderful project. I have about 300 websites and i would like to track them all, i have webapp that manages header scripts of all those sites so my question is, is there a way to bulk add sites in motomo, like insert same script to each site and it will detect and generate data for them?

Thanks

Hi,

Matomo has an extensive API that allows you to automate every action:

https://developer.matomo.org/api-reference/reporting-api#SitesManager

In your case the SitesManager.addSite API is most helpful.

So the URL looks something like (without newlines)

https://matomo.example/?module=API&method=SitesManager.addSite
&siteName=TheName
&urls=https://example.com/
&format=JSON
&token_auth=[your token_auth]

If you then know the siteId of the website, you can even automate the fetching of the tracking code

https://matomo.example/?module=API&method=SitesManager.getJavascriptTag
&idSite=7
&format=JSON
&token_auth=[your token]