You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support different Matomo Site IDs per API-key or domain (multi-service / multi-client / multi-tenant use case) #2588
I'm testing Shlink with multiple domains and I already use the multiple domains feature.
Each of my domains/services has its own separate Matomo instance (different Site ID for each).
However, the current Matomo integration in Shlink is global: only one MATOMO_SITE_ID environment variable is supported for the entire instance.
All visits from all domains end up tracked in the same Matomo site.
Current workarounds
Assign custom tags to every short URL and create segments in each Matomo (manual and not scalable)
Run separate Shlink instances per domain (loses the benefits of the native multi-domain feature and increases maintenance)
Proposed solution
Add support for a different Matomo Site ID per API key or per domain (preferred).
Possible implementations:
Add a matomo_site_id column to the domains table (abstract)
Use case
Domain serviceA.com → should send visits to Matomo Site ID 1
Domain serviceB.com → should send visits to Matomo Site ID 2
Domain serviceC.com → should send visits to Matomo Site ID 3
…and so on for each additional domain
This would allow each domain/service to have completely isolated analytics in its own Matomo instance without any manual segmentation or filtering.
I have been exploring this, and I think I won't be supporting per-domain matomo keys, because it makes things over complicated for something most people won't need.
It is also not very flexible if in the future there's a need to split visits in different matomo instances by some other indicator (by visit type, by destination, etc.).
Instead, I have been exploring custom segmentation options in matomo. I will support a way to send so known custom dimensions, in matomo terminology.
Shlink will support sending three custom dimensions:
Domain
Is orphan (true or false)
Visit type (valid_short_url, invalid_short_url, base_url, regular_404)
Dimensions need to be configured in your Matomo instance. It assigns an ID to each one of them, and you will have to provide those IDs to Shlink for it to set them (via env vars or configuration).
This approach allows to add more custom dimensions in the future if new needs appear, in a more convenient way.
Matomo let's you then use dimensions as a way to segment your visitors, so you would be able to see visits for one domain only, for example.
Activity
acelaya commentedon Nov 13, 2026
Shlink should already be sending the full short url (or visited url for orphan visits) to Matomo.
Isn't there a way to filter out/segment by domain in Matomo?
acelaya commentedon Nov 21, 2026
I have been exploring this, and I think I won't be supporting per-domain matomo keys, because it makes things over complicated for something most people won't need.
It is also not very flexible if in the future there's a need to split visits in different matomo instances by some other indicator (by visit type, by destination, etc.).
Instead, I have been exploring custom segmentation options in matomo. I will support a way to send so known custom dimensions, in matomo terminology.
Shlink will support sending three custom dimensions:
Dimensions need to be configured in your Matomo instance. It assigns an ID to each one of them, and you will have to provide those IDs to Shlink for it to set them (via env vars or configuration).
This approach allows to add more custom dimensions in the future if new needs appear, in a more convenient way.
Matomo let's you then use dimensions as a way to segment your visitors, so you would be able to see visits for one domain only, for example.