Open Prinzhorn opened 3 years ago
In theory you can have multiple sites in Matomo tracking the same url. There is an API method SitesManager.getSitesIdFromSiteUrl
which returns all IDs for a given url. That method is actually already used when you do not provide an idsite but an host is included in the logfile. The logimporter then automatically tries to find the correct sites based on the url. So guess we could implement such an option a similar way.
Oh neat. I'm not sure when I could look into this, I'll post here if I do to avoid double work. I personally would give --namesite
precedence over --idsite
. But if only --namesite
is specified it would exit if getSitesIdFromSiteUrl
returns more than one result (with a message listing all ids that were found). In this case --idsite
would be required in addition and needs to be in the list returned from getSitesIdFromSiteUrl
. This would make it super hard to import into the wrong site and even handle the case were you're using the same URL multiple times.
Edit: To be clear, that API you've mentioned is for the bottom list of URLs? There's probably something for just the name I assume
I assume there is an API to lookup the id by
site.name
or an API to achieve the same effect. If so then it would be great to add a--namesite
argument, e.g.--namesite=www.example.com
. I'm dumping dozens of sites into a Matomo instance (never used Matomo before) and IDs are not meant for humans. I'm waiting for the moment I import logs into the wrong site. And if I end up with multiple scripts along the way I don't want to go back and forth and check the id later once I forgot. How do others manage that?