Tracking Actions

I watch code of plugins : Actions of piwik. I have some questions.

  1. Actions database :
  • table _log_actions : have column type.Depend on what standard , when you log information of javascript you can classify them into : download, outlink, action url, action name ( especiallly url, name)
  • table : log_link_visit_action : what idlink_va, idaction_url, idaction_name, because i see deffirent explain of this article dev.piwik.org/trac/wiki/DatabaseSchema
  1. when archiving actions :
    why you have to use to 2 same query :
/*
         * Actions urls global information
         */
        $query = "SELECT     name,
                            type,
                            count(distinct t1.idvisit) as nb_visits, 
                            count(distinct visitor_idcookie) as nb_uniq_visitors,
                            count(*) as nb_hits                            
                    FROM (".$archiveProcessing->logTable." as t1
                        LEFT JOIN ".$archiveProcessing->logVisitActionTable." as t2 USING (idvisit))
                            LEFT JOIN ".$archiveProcessing->logActionTable." as t3 ON (t2.idaction_url = t3.idaction)
                    WHERE visit_server_date = ?
                        AND idsite = ?
                    GROUP BY t3.idaction
                    ORDER BY nb_hits DESC";
        $query = $archiveProcessing->db->query($query, array( $archiveProcessing->strDateStart, $archiveProcessing->idsite ));
        $modified = $this->updateActionsTableWithRowQuery($query);

        /*
         * Actions names global information
         */
        $query = "SELECT     name,
                            type,
                            count(distinct t1.idvisit) as nb_visits,
                            count(distinct visitor_idcookie) as nb_uniq_visitors,
                            count(*) as nb_hits
                    FROM (".$archiveProcessing->logTable." as t1
                        LEFT JOIN ".$archiveProcessing->logVisitActionTable." as t2 USING (idvisit))
                            LEFT JOIN ".$archiveProcessing->logActionTable." as t3 ON (t2.idaction_name = t3.idaction)
                    WHERE visit_server_date = ?
                        AND idsite = ?
                    GROUP BY t3.idaction
                    ORDER BY nb_hits DESC";
        $query = $archiveProcessing->db->query($query, array( $archiveProcessing->strDateStart, $archiveProcessing->idsite ));
        $modified = $this->updateActionsTableWithRowQuery($query);

So what the deffirent between Actions urls global information, Actions names global information

The first query is use to create the Pages report. The second query is used for the Pages title report.