Knowledgebase:Statistik

From Cloudrexx Development Wiki
Jump to: navigation, search

Kurzbeschreibung

Die Statistiken bieten eine umfangreiche Auswertung des Nutzerverhaltens, wie z.B. Besucher auf jeder Seite ihrer Website, Dauer des Aufenthalts, Herkunft der Besucher, Ausführungszeiten der Seiten, Sessionauswertung, graphische Darstellung der Besucherzahl und Auswertung von Google-und anderen Suchmaschinen Suchwörtern

Statistiken

Beispiel3.jpg

Diese Statistik zeigt an wie viele Leute mit welchem Betriebssystem die Contrexx Website besucht haben

Übersicht

Browser

Beispiel2.jpg

Diese Statistik zeigt an welchen Webbrowser die Leute benutzen welche Contrexx.com besucht haben

Seitenaufrufe

Beispiel5.jpg

Das ist eine Statistik die anzeigt zu welcher zeit wie viele Leute wie viele Seiten besucht haben

Einstellungen

Beisp.jpg

Hier kann man Einstellungen für die Statistiken machen

FAQ

Statistik Bereich Besucher und Seitenaufrufe ist extrem langsam

Bei älteren Versionen von Contrexx als 1.1 kann es vorkommen dass der Bereich "Besucher und Seitenaufrufe" der Statistik extrem langsam geladen wird (oder überhaupt nicht mehr). Das Problem liegt dabei bei nicht optimalen Datenbank Abfragen in den Dateien core_modules/stats/lib/statsLib.class.php und core_modules/stats/graph.php.

Durch Anpassung der Datenbank Abfragen gemäss nachfolgenden Angaben kann das Problem behoben werden. WICHTIG: Nachfolgend wird als installierte Version die Version 1.0.9.10.1 angenommen. Ist eine ältere Version im Einsatz, müssen gegebenenfalls einige Sachen entsprechend adaptiert werden.

core_modules/stats/graph.php

_makeRequestsHoursGraph()

Innerhalb der Funktion _makeRequestsHoursGraph() den Code

<HIGHLIGHTSYNTAX>// get statistics $query = "SELECT FROM_UNIXTIME(`tbl_r`.`timestamp`, '%H' ) AS `hour` , `tbl_r`.`count` AS requests, `tbl_v`.`count` AS visitors FROM `".DBPREFIX."stats_requests_summary` AS tbl_r LEFT OUTER JOIN `".DBPREFIX."stats_visitors_summary` AS tbl_v ON FROM_UNIXTIME( `tbl_r`.`timestamp` , '%d-%m-%Y' ) = '".date('d-m-Y')."' AND FROM_UNIXTIME( `tbl_v`.`timestamp` , '%d-%m-%Y' ) = '".date('d-m-Y')."' AND FROM_UNIXTIME(`tbl_r`.`timestamp`, '%H' ) = FROM_UNIXTIME(`tbl_v`.`timestamp`, '%H' ) AND `tbl_r`.type = `tbl_v`.type WHERE `tbl_r`.`type` = 'hour' AND ((`tbl_r`.`count` > 0 AND FROM_UNIXTIME( `tbl_r`.`timestamp` , '%d-%m-%Y' ) = '".date('d-m-Y')."') OR (`tbl_v`.`count` > 0 AND FROM_UNIXTIME( `tbl_v`.`timestamp` , '%d-%m-%Y' ) = '".date('d-m-Y')."'))"; $result = $objDb->Execute($query); if ($result) { while ($arrResult = $result->FetchRow()) { $arrBarPlot1[$arrResult['hour']] = $arrResult['visitors']; $arrBarPlot2[$arrResult['hour']] = $arrResult['requests']; } }</HIGHLIGHTSYNTAX>

ersetzen mit <HIGHLIGHTSYNTAX> // get statistics $query = "SELECT FROM_UNIXTIME(`timestamp`, '%H' ) AS `hour` , `count` FROM `".DBPREFIX."stats_visitors_summary` WHERE FROM_UNIXTIME( `timestamp` , '%d-%m-%Y' ) = '".date('d-m-Y')."' AND `type` = 'hour' AND `count` > 0"; $result = $objDb->Execute($query); if ($result) { while ($arrResult = $result->FetchRow()) { $arrBarPlot1[$arrResult['hour']] = $arrResult['count']; } } $query = "SELECT FROM_UNIXTIME(`timestamp`, '%H' ) AS `hour` , `count` FROM `".DBPREFIX."stats_requests_summary` WHERE FROM_UNIXTIME( `timestamp` , '%d-%m-%Y' ) = '".date('d-m-Y')."' AND `type` = 'hour' AND `count` > 0"; $result = $objDb->Execute($query); if ($result) { while ($arrResult = $result->FetchRow()) { $arrBarPlot2[$arrResult['hour']] = $arrResult['count']; } }</HIGHLIGHTSYNTAX>


_makeRequestsDaysGraph()

Innerhalb der Funktion _makeRequestsDaysGraph() den Code <HIGHLIGHTSYNTAX> // get statistics $query = "SELECT FROM_UNIXTIME(`tbl_r`.`timestamp`, '%d' ) AS `day` , `tbl_r`.`count` AS requests, `tbl_v`.`count` AS visitors FROM `".DBPREFIX."stats_requests_summary` AS tbl_r

LEFT OUTER JOIN `".DBPREFIX."stats_visitors_summary` AS tbl_v

ON FROM_UNIXTIME( `tbl_r`.`timestamp` , '%m-%Y' ) = '".date('m-Y')."' AND FROM_UNIXTIME( `tbl_v`.`timestamp` , '%m-%Y' ) = '".date('m-Y')."' AND FROM_UNIXTIME(`tbl_r`.`timestamp`, '%d' ) = FROM_UNIXTIME(`tbl_v`.`timestamp`, '%d' ) AND `tbl_r`.type = `tbl_v`.type WHERE `tbl_r`.`type` = 'day' AND ((`tbl_r`.`count` > 0 AND FROM_UNIXTIME( `tbl_r`.`timestamp` , '%m-%Y' ) = '".date('m-Y')."') OR (`tbl_v`.`count` > 0 AND FROM_UNIXTIME( `tbl_v`.`timestamp` , '%m-%Y' ) = '".date('m-Y')."'))"; $result = $objDb->Execute($query); if ($result) { while ($arrResult = $result->FetchRow()) { $arrBarPlot1[$arrResult['day']] = $arrResult['visitors']; $arrBarPlot2[$arrResult['day']] = $arrResult['requests']; } }</HIGHLIGHTSYNTAX>


ersetzen mit <HIGHLIGHTSYNTAX> // get statistics $query = "SELECT FROM_UNIXTIME(`timestamp`, '%d' ) AS `day` , `count` FROM `".DBPREFIX."stats_visitors_summary` WHERE `type` = 'day' AND `count` > 0 AND FROM_UNIXTIME( `timestamp` , '%m-%Y' ) = '".date('m-Y')."'"; $result = $objDb->Execute($query); if ($result) { while ($arrResult = $result->FetchRow()) { $arrBarPlot1[$arrResult['day']] = $arrResult['count']; } }

$query = "SELECT FROM_UNIXTIME(`timestamp`, '%d' ) AS `day` , `count` FROM `".DBPREFIX."stats_requests_summary` WHERE `type` = 'day' AND `count` > 0 AND FROM_UNIXTIME( `timestamp` , '%m-%Y' ) = '".date('m-Y')."'"; $result = $objDb->Execute($query); if ($result) { while ($arrResult = $result->FetchRow()) { $arrBarPlot2[$arrResult['day']] = $arrResult['count']; } }</HIGHLIGHTSYNTAX>


_makeRequestsMonthsGraph()

Innerhalb der Funktion _makeRequestsMonthsGraph() den Code <HIGHLIGHTSYNTAX> // get statistics $query = "SELECT FROM_UNIXTIME(`tbl_r`.`timestamp`, '%m' ) AS `month` , `tbl_r`.`count` AS requests, `tbl_v`.`count` AS visitors FROM `".DBPREFIX."stats_requests_summary` AS tbl_r

LEFT OUTER JOIN `".DBPREFIX."stats_visitors_summary` AS tbl_v

ON FROM_UNIXTIME( `tbl_r`.`timestamp` , '%Y' ) = '".date('Y')."' AND FROM_UNIXTIME( `tbl_v`.`timestamp` , '%Y' ) = '".date('Y')."' AND FROM_UNIXTIME(`tbl_r`.`timestamp`, '%m' ) = FROM_UNIXTIME(`tbl_v`.`timestamp`, '%m' ) AND `tbl_r`.type = `tbl_v`.type WHERE `tbl_r`.`type` = 'month' AND ((`tbl_r`.`count` > 0 AND FROM_UNIXTIME( `tbl_r`.`timestamp` , '%Y' ) = '".date('Y')."') OR (`tbl_v`.`count` > 0 AND FROM_UNIXTIME( `tbl_v`.`timestamp` , '%Y' ) = '".date('Y')."'))"; $result = $objDb->Execute($query); if ($result) { while ($arrResult = $result->FetchRow()) { $arrBarPlot1[$arrResult['month']] = $arrResult['visitors']; $arrBarPlot2[$arrResult['month']] = $arrResult['requests']; } }</HIGHLIGHTSYNTAX>


ersetzen mit <HIGHLIGHTSYNTAX> // get statistics $query = "SELECT FROM_UNIXTIME(`timestamp`, '%m' ) AS `month` , `count` FROM `".DBPREFIX."stats_visitors_summary` WHERE `type` = 'month' AND `count` > 0 AND FROM_UNIXTIME( `timestamp` , '%Y' ) = '".date('Y')."'"; $result = $objDb->Execute($query); if ($result) { while ($arrResult = $result->FetchRow()) { $arrBarPlot1[$arrResult['month']] = $arrResult['count']; } }

$query = "SELECT FROM_UNIXTIME(`timestamp`, '%m' ) AS `month` , `count` FROM `".DBPREFIX."stats_requests_summary` WHERE `type` = 'month' AND `count` > 0 AND FROM_UNIXTIME( `timestamp` , '%Y' ) = '".date('Y')."'"; $result = $objDb->Execute($query); if ($result) { while ($arrResult = $result->FetchRow()) { $arrBarPlot2[$arrResult['month']] = $arrResult['count']; } }</HIGHLIGHTSYNTAX>


_makeRequestsYearsGraph()

Innerhalb der Funktion _makeRequestsYearsGraph() den Code <HIGHLIGHTSYNTAX> // get statistics $query = "SELECT FROM_UNIXTIME(`tbl_r`.`timestamp`, '%Y' ) AS `year` , `tbl_r`.`count` AS requests, `tbl_v`.`count` AS visitors FROM `".DBPREFIX."stats_requests_summary` AS tbl_r

LEFT OUTER JOIN `".DBPREFIX."stats_visitors_summary` AS tbl_v

ON FROM_UNIXTIME(`tbl_r`.`timestamp`, '%Y' ) = FROM_UNIXTIME(`tbl_v`.`timestamp`, '%Y' ) AND `tbl_r`.type = `tbl_v`.type WHERE `tbl_r`.`type` = 'year' ORDER BY `year`"; $result = $objDb->Execute($query); if ($result) { while ($arrResult = $result->FetchRow()) { $arrBarPlot1[$arrResult['year']] = $arrResult['visitors']; $arrBarPlot2[$arrResult['year']] = $arrResult['requests']; } }</HIGHLIGHTSYNTAX>


ersetzen mit <HIGHLIGHTSYNTAX> // get statistics $query = "SELECT FROM_UNIXTIME(`timestamp`, '%Y' ) AS `year` , `count` FROM `".DBPREFIX."stats_visitors_summary` WHERE `type` = 'year' ORDER BY `year`"; $result = $objDb->Execute($query); if ($result) { while ($arrResult = $result->FetchRow()) { $arrBarPlot1[$arrResult['year']] = $arrResult['count']; } }

$query = "SELECT FROM_UNIXTIME(`timestamp`, '%Y' ) AS `year` , `count` FROM `".DBPREFIX."stats_requests_summary` WHERE `type` = 'year' ORDER BY `year`"; $result = $objDb->Execute($query); if ($result) { while ($arrResult = $result->FetchRow()) { $arrBarPlot2[$arrResult['year']] = $arrResult['count']; } }</HIGHLIGHTSYNTAX>


core_modules/stats/lib/statsLib.class.php

_initStatisticsToday()

Innerhalb der Methode _initStatisticsToday() den Code <HIGHLIGHTSYNTAX> // get statistics $query = "SELECT FROM_UNIXTIME(`tbl_r`.`timestamp`, '%H' ) AS `hour` , `tbl_r`.`count` AS requests, `tbl_v`.`count` AS visitors FROM `".DBPREFIX."stats_requests_summary` AS tbl_r

LEFT OUTER JOIN `".DBPREFIX."stats_visitors_summary` AS tbl_v

ON FROM_UNIXTIME( `tbl_r`.`timestamp` , '%d-%m-%Y' ) = '".date('d-m-Y')."' AND FROM_UNIXTIME( `tbl_v`.`timestamp` , '%d-%m-%Y' ) = '".date('d-m-Y')."' AND FROM_UNIXTIME(`tbl_r`.`timestamp`, '%H' ) = FROM_UNIXTIME(`tbl_v`.`timestamp`, '%H' ) AND `tbl_r`.type = `tbl_v`.type WHERE `tbl_r`.`type` = 'hour' AND ((`tbl_r`.`count` > 0 AND FROM_UNIXTIME( `tbl_r`.`timestamp` , '%d-%m-%Y' ) = '".date('d-m-Y')."') OR (`tbl_v`.`count` > 0 AND FROM_UNIXTIME( `tbl_v`.`timestamp` , '%d-%m-%Y' ) = '".date('d-m-Y')."'))"; $objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { $this->arrRequests[$objResult->fields['hour']] = array( 'visitors' => $objResult->fields['visitors'], 'requests' => $objResult->fields['requests'] ); $this->totalVisitors += $objResult->fields['visitors']; $this->totalRequests += $objResult->fields['requests']; $objResult->MoveNext(); }</HIGHLIGHTSYNTAX>


ersetzen mit <HIGHLIGHTSYNTAX> // get statistics $query = "SELECT FROM_UNIXTIME(`timestamp`, '%H' ) AS `hour` , `count` FROM `".DBPREFIX."stats_visitors_summary` WHERE `type` = 'hour' AND `count` > 0 AND FROM_UNIXTIME( `timestamp` , '%d-%m-%Y' ) = '".date('d-m-Y')."'"; $objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { $this->arrRequests[$objResult->fields['hour']]['visitors'] = $objResult->fields['count']; $this->totalVisitors += $objResult->fields['count']; $objResult->MoveNext(); }

$query = "SELECT FROM_UNIXTIME(`timestamp`, '%H' ) AS `hour` , `count` FROM `".DBPREFIX."stats_requests_summary` WHERE `type` = 'hour' AND `count` > 0 AND FROM_UNIXTIME( `timestamp` , '%d-%m-%Y' ) = '".date('d-m-Y')."'"; $objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { $this->arrRequests[$objResult->fields['hour']]['requests'] = $objResult->fields['count']; $this->totalRequests += $objResult->fields['count']; $objResult->MoveNext(); }</HIGHLIGHTSYNTAX>


_initStatisticsDays()

Innerhalb der Methode _initStatisticsDays() den Code <HIGHLIGHTSYNTAX> // get statistics $query = "SELECT FROM_UNIXTIME(`tbl_r`.`timestamp`, '%e' ) AS `day` , `tbl_r`.`count` AS requests, `tbl_v`.`count` AS visitors FROM `".DBPREFIX."stats_requests_summary` AS tbl_r

LEFT OUTER JOIN `".DBPREFIX."stats_visitors_summary` AS tbl_v

ON FROM_UNIXTIME( `tbl_r`.`timestamp` , '%m-%Y' ) = '".date('m-Y')."' AND FROM_UNIXTIME( `tbl_v`.`timestamp` , '%m-%Y' ) = '".date('m-Y')."' AND FROM_UNIXTIME(`tbl_r`.`timestamp`, '%d' ) = FROM_UNIXTIME(`tbl_v`.`timestamp`, '%d' ) AND `tbl_r`.type = `tbl_v`.type WHERE `tbl_r`.`type` = 'day' AND ((`tbl_r`.`count` > 0 AND FROM_UNIXTIME( `tbl_r`.`timestamp` , '%m-%Y' ) = '".date('m-Y')."') OR (`tbl_v`.`count` > 0 AND FROM_UNIXTIME( `tbl_v`.`timestamp` , '%m-%Y' ) = '".date('m-Y')."'))"; $objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { $this->arrRequests[$objResult->fields['day']] = array( 'visitors' => $objResult->fields['visitors'], 'requests' => $objResult->fields['requests'] ); $this->totalVisitors += $objResult->fields['visitors']; $this->totalRequests += $objResult->fields['requests']; $objResult->MoveNext(); }</HIGHLIGHTSYNTAX>


ersetzen mit <HIGHLIGHTSYNTAX> // get statistics $query = "SELECT FROM_UNIXTIME(`timestamp`, '%e' ) AS `day` , `count` FROM `".DBPREFIX."stats_visitors_summary`

				   WHERE `type` = 'day' AND `count` > 0 AND FROM_UNIXTIME( `timestamp` , '%m-%Y' ) = '".date('m-Y')."'";

$objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { $this->arrRequests[$objResult->fields['day']]['visitors'] = $objResult->fields['count']; $this->totalVisitors += $objResult->fields['count']; $objResult->MoveNext(); }

$query = "SELECT FROM_UNIXTIME(`timestamp`, '%e' ) AS `day` , `count` FROM `".DBPREFIX."stats_requests_summary`

				   WHERE `type` = 'day' AND `count` > 0 AND FROM_UNIXTIME( `timestamp` , '%m-%Y' ) = '".date('m-Y')."'";

$objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { $this->arrRequests[$objResult->fields['day']]['requests'] = $objResult->fields['count']; $this->totalRequests += $objResult->fields['count']; $objResult->MoveNext(); }</HIGHLIGHTSYNTAX>


_initStatisticsMonths()

Innerhalb der Methode _initStatisticsMonths() den Code <HIGHLIGHTSYNTAX> // get statistics $query = "SELECT FROM_UNIXTIME(`tbl_r`.`timestamp`, '%c' ) AS `month` , `tbl_r`.`count` AS requests, `tbl_v`.`count` AS visitors FROM `".DBPREFIX."stats_requests_summary` AS tbl_r

LEFT OUTER JOIN `".DBPREFIX."stats_visitors_summary` AS tbl_v

ON FROM_UNIXTIME( `tbl_r`.`timestamp` , '%Y' ) = '".date('Y')."' AND FROM_UNIXTIME( `tbl_v`.`timestamp` , '%Y' ) = '".date('Y')."' AND FROM_UNIXTIME(`tbl_r`.`timestamp`, '%m' ) = FROM_UNIXTIME(`tbl_v`.`timestamp`, '%m' ) AND `tbl_r`.type = `tbl_v`.type WHERE `tbl_r`.`type` = 'month' AND ((`tbl_r`.`count` > 0 AND FROM_UNIXTIME( `tbl_r`.`timestamp` , '%Y' ) = '".date('Y')."') OR (`tbl_v`.`count` > 0 AND FROM_UNIXTIME( `tbl_v`.`timestamp` , '%Y' ) = '".date('Y')."'))"; $objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { $this->arrRequests[$objResult->fields['month']] = array( 'visitors' => $objResult->fields['visitors'], 'requests' => $objResult->fields['requests'] ); $this->totalVisitors += $objResult->fields['visitors']; $this->totalRequests += $objResult->fields['requests']; $objResult->MoveNext(); }</HIGHLIGHTSYNTAX>


ersetzen mit <HIGHLIGHTSYNTAX> // get statistics $query = "SELECT FROM_UNIXTIME(`timestamp`, '%c' ) AS `month` , `count` FROM `".DBPREFIX."stats_visitors_summary` WHERE `type` = 'month' AND `count` > 0 AND FROM_UNIXTIME( `timestamp` , '%Y' ) = '".date('Y')."'"; $objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { $this->arrRequests[$objResult->fields['month']]['visitors'] = $objResult->fields['count']; $this->totalVisitors += $objResult->fields['count']; $objResult->MoveNext(); }

$query = "SELECT FROM_UNIXTIME(`timestamp`, '%c' ) AS `month` , `count` FROM `".DBPREFIX."stats_requests_summary` WHERE `type` = 'month' AND `count` > 0 AND FROM_UNIXTIME( `timestamp` , '%Y' ) = '".date('Y')."'"; $objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { $this->arrRequests[$objResult->fields['month']]['requests'] = $objResult->fields['count']; $this->totalRequests += $objResult->fields['count']; $objResult->MoveNext(); }</HIGHLIGHTSYNTAX>


_initStatisticsYears()

Innerhalb der Methode _initStatisticsYears() den Code <HIGHLIGHTSYNTAX> // get statistics $query = "SELECT FROM_UNIXTIME(`tbl_r`.`timestamp`, '%Y' ) AS `year` , `tbl_r`.`count` AS requests, `tbl_v`.`count` AS visitors FROM `".DBPREFIX."stats_requests_summary` AS tbl_r

LEFT OUTER JOIN `".DBPREFIX."stats_visitors_summary` AS tbl_v

ON FROM_UNIXTIME(`tbl_r`.`timestamp`, '%Y' ) = FROM_UNIXTIME(`tbl_v`.`timestamp`, '%Y' ) AND `tbl_r`.type = `tbl_v`.type WHERE `tbl_r`.`type` = 'year' ORDER BY `year`"; $objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { $this->arrRequests[$objResult->fields['year']] = array( 'visitors' => $objResult->fields['visitors'], 'requests' => $objResult->fields['requests'] ); $this->totalVisitors += $objResult->fields['visitors']; $this->totalRequests +=$objResult->fields['requests']; $objResult->MoveNext(); }</HIGHLIGHTSYNTAX>


ersetzen mit <HIGHLIGHTSYNTAX> // get statistics $query = "SELECT FROM_UNIXTIME(`timestamp`, '%Y' ) AS `year` , `count` FROM `".DBPREFIX."stats_visitors_summary` WHERE `type` = 'year' ORDER BY `year`"; $objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { $this->arrRequests[$objResult->fields['year']]['visitors'] = $objResult->fields['count']; $this->totalVisitors += $objResult->fields['count']; $objResult->MoveNext(); }

$query = "SELECT FROM_UNIXTIME(`timestamp`, '%Y' ) AS `year` , `count` FROM `".DBPREFIX."stats_requests_summary` WHERE `type` = 'year' ORDER BY `year`"; $objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { $this->arrRequests[$objResult->fields['year']]['requests'] = $objResult->fields['count']; $this->totalRequests +=$objResult->fields['count']; $objResult->MoveNext(); }</HIGHLIGHTSYNTAX>