Getting referrers for all websites

I know the API provides easy access to states on a per-site basis. But what I need to do is get an overview report from activity on all websites. Specifically, I need a Mysql query that’ll show me the top 10 referrers for the day across all piwik sites.

There doesn’t seem to be a way to do this via the API, so I was wondering if anyone has written a query to get this from the database directly? I already wrote a query that does this for the top 10 pages across all sites, but the query for referrers seems to be much harder to craft.



PS - It would be a great feature for a future release to allow queries to the API where the siteID = 0 or null or something in order to get an overview of all sites within the database.