Make Rank for MultiSites


(MeTaFoRiC) #1

Hello, and first sorry for my bad english :stuck_out_tongue:

I try to create a table in the database of Multisite with the name Rank, with 2 rows, yesterday rank, and today rank. The yesterday rank have the order of the sites by the visits of yesterday, and the today rank have the order of the sites by the visits of today. This table we gonna refresh every hour with a cronjob or in the same script that refresh the visits count(better if is posible). For example the table in the mysql is something like this:
Site ID YesterdayRank TodayRank
123 2 1
156 1 2

Or i thing that is posible to do this using the visits data. When order the websites by visits to add a descendent number for websites. For example for the first website with bigger visits add the rank 1 in Multisite page, for the second rank 2, etc…
And the yesterday ranking show the same, but using the yesterday visits data.

And the next problem is to add the variable in MultiSite

like that:

Y. Rank T. Rank WebSite Visits Page Visits
2 1 mywebsite1 600 1000
1 2 mywebsite2 450 700

If someone can help me i give ∞ Thanks.


(Matthieu Aubry) #2

I recommend you try Piwik beta 301 Moved Permanently and look at the new API MultiSites.getAll it will give you the data you need to produce the ranks, i believe?


(MeTaFoRiC) #3

Ok, first i use the API MultiSites.getAll to have the data for the last7 days, but i want to display more data for this API. I want to display:

Name Of Website (label)
Visits (nb_visits)
Actions (nb_actions)
Unique Visitors (nb_uniq_visitors)
URL of Website (main_url)

So, the first 3 is there, but i want the last 2. I try to modify the MultiSites Plugin to do that:

i add where the row visits are in the files API.php, Controller.php, MultiSites.php another row with visitors, where visits are i add visitors, and where nb_visits are i add nb_uniq_visitors. Everything fine, if i request the API for 1 day show me the unique visitors of that day, but if i request the API for the last 7days is not showme the unique visitors. i thing the problem is TotalVisitors are not defined or something like that. What i can do?

I want all this data to add all in one mysql table, with the rank, and create another dashboard. The script that insert this data in the table, have a cronjob set, and is running every hour.


(Matthieu Aubry) #4

see How to - Analytics Platform - Matomo