How to combine subdomains in external links overview?

On my dashboard there is the external links area where URLs are listet from which users came to my website. Links which belong to one domain are combined to provide a better readability - which is actually pretty useful. Unfortunately subdomains are not combined. So e.g. for pinterest I got a list auf all the language domains of pinterest (,, …) instead of counting all the pinterest links all together. Any Idea how to improve this?

I would probably simply rewrite the “setReferrerUrl” to exclude the subdomain string and reduce the URL to the top-level-domain.
Reference: JavaScript Tracking Client: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3
Written in JS it’s quite close to what hjkatz did here:

For quickly analyzing past visits I’d export to TSV and make some spreadsheet magic.

But this would prevent these URLs from being tracked distinguishable, wouldn’t it? I just want them to be displayed summarized. I still want to be able to unfold the summarized links to see exactly where the visitor came from.

Yep, I think the information would be lost. I don’t see any other “easy” way of handling it. Anyone?

I figured out that the Piwik only requests the (sub)domains - not the exact URLs - of the referrers, when loading the dashboard. Only if the user tries to unfold the displayed (sub)domains, a second request is send to get all referrers of this (sub)domain.

If I’d know in what part of the code piwik summarizes those several referrer links, I could probably manipulate it to combine not just URLs with the exact same domain but also include subdomains. Unfortunately I was unable to figure out where this. Does anyone have an idea?