matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.8k stars 2.64k forks source link

Cross websites reporting: Let me see the number of users who browsed two websites (new plugin) #6082

Open mattab opened 10 years ago

mattab commented 10 years ago

The goal of this ticket is to create a new plugin published on the Marketplace that will let a user pick two websites from the list of tracked websites in Piwik, and will then output the number of unique users that visited both websites in the selected time period.

Proposal

Tasks

Note: for more advanced cross websites reporting, check out the RollUp Reporting plugin. see also #6079

tassoman commented 10 years ago

This plugin would be nice for users with many Sites, we have dozens. How this could involve outgoing clicks? Would be good also appending to its stat a revised "outgoing links" minus the "between sites" amounts. Another part that would be affected by this would be the tansaction graphs: "from websites" would be splitted in "from others websites", "from our websites"

kylekatarnls commented 10 years ago

+1 It would be very great!

mattab commented 10 years ago

How this could involve outgoing clicks? Would be good also appending to its stat a revised "outgoing links" minus the "between sites" amounts.

That's a good idea.

mattab commented 10 years ago

For the SQL query to detect unique users across websites, maybe this is a good and fast option?

Example to get number of cross users across website 1 and 2:

SELECT count(distinct config_id)
FROM
(
   SELECT log_visit_t1.config_id
    FROM piwik_log_visit as log_visit_t1 
        INNER JOIN piwik_log_visit as log_visit_t2 
    WHERE log_visit_t1.config_id = log_visit_t2.config_id 
       AND log_visit_t1.idsite = 1 
       AND log_visit_t2.idsite = 2  
 ) as config_ids
kylekatarnls commented 10 years ago

Maybe a newbie question, but is it different from this:

SELECT COUNT(DISTINCT log_visit_t1.config_id) AS config_ids
    FROM piwik_log_visit as log_visit_t1 
        INNER JOIN piwik_log_visit as log_visit_t2 
    WHERE log_visit_t1.config_id = log_visit_t2.config_id 
       AND log_visit_t1.idsite = 1 
       AND log_visit_t2.idsite = 2

?

tassoman commented 10 years ago

I've ran both against my test db and tooks abt 297ms in the first case and abt 234ms in second case. Result was 749

mattab commented 10 years ago

@kylekatarnls good point we don't need the outer query, yours works better :+1:

diosmosis commented 10 years ago

Plugin is here: https://github.com/PiwikPRO/plugin-InterSites

Closing ticket.

@tassoman I put your suggestion here: https://github.com/PiwikPRO/plugin-InterSites/issues/1

mattab commented 7 years ago

InterSites not compatible with Piwik 3, re-opening

mattab commented 7 years ago

We've released a new premium plugin which aggregates data from multiple websites, mobile apps and shops into a Roll-Up site to gain new insights and save time. Also gives you a view of visitors across several websites/apps.

Get it here: https://plugins.piwik.org/RollUpReporting