Hourly piwik like daily but hourly

Hello, is there any plan to add hourly reporting to piwik? Like in the selection box where i choose day, week, month…i would like to choose hour here.

Is this possible or planned?

Thank you.

Not possible nor planned!

Its not possible? It cannot be must more than a simple range choosing on the mysql query…right? Or is it more difficult?

Hey, I found this thread by google searching as I was trying to find hourly reporting for piwik. Seeing that there wasn’t hourly reporting, I ended up looking at the database and found it had all the information necessary so I created the database calls and printed out the hourly info in a nice format using php. Furthermore, I created an html form to let one type in the necessary info to get the information.

I’m using this for tracking campaign information (Not “visitors”), as I use campaigns for tracking images using my own custom code, so I only need to type in the campaign name and keyword to retrieve the hourly info. I’ve attaced the files should it be helpful to anyone else.

PHP hourly reporting code (Filename:getHourlyStats.php)


<?php
// Make a MySQL Connection
$host        =    "localhost";
$user        =    "craigs15_admin";
$pass        =    "anime777666";
$tablename    =    "craigs15_everythingelse";

    $con = mysql_connect($host,$user,$pass) ;
    
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
  
  mysql_select_db($tablename, $con);
  
$query = "select visit_first_action_time
from piwik_log_visit
where referer_name LIKE '%".$_GET["name"]."%' AND referer_keyword LIKE '%".$_GET["keyword"]."%'
order by visit_first_action_time ASC"; 
	 
$result = mysql_query($query) or die(mysql_error());

$i = 0;
$ithHour=0;
$numWithinHour=0;
$lowestDate;
$lowestDateInSecs;
$nextHourInSecs;
$nextHourInDate;
while($row = mysql_fetch_array($result))
{
	$date=$row['visit_first_action_time'];
	
	//$datetime1 = new DateTime('1970-10-11');
	$datetime2 = new DateTime($date);
	
	
	
	//$interval = date_diff($datetime1, $datetime2);
	$dateInSecs = $datetime2->format('U');//$interval->format('%s');
	
	if($i==0)
	{
		$lowestDate = $datetime2;
		$lowestDateInSecs = $dateInSecs;
		$nextHourInSecs = $lowestDateInSecs+60*60;
		$nextHourInDate = $lowestDate;
		date_add($nextHourInDate, date_interval_create_from_date_string('1 hour'));
	}
	//echo $dateInSecs.":".$nextHourInSecs."<br>";
	if($dateInSecs>$nextHourInSecs)
	{
		$nextHourDateAdj = clone $nextHourInDate;
		date_sub($nextHourDateAdj, date_interval_create_from_date_string('7 hours'));
		echo "Hour ".$ithHour.": ".$numWithinHour." views   ...  ".$nextHourDateAdj->format('Y-m-d H:i:s')."<br>";
		$nextHourInSecs+=60*60;
		$numWithinHour=0;
		$ithHour++;
		date_add($nextHourInDate, date_interval_create_from_date_string('1 hour'));
	}
	else
	{
	  $numWithinHour++;
	}
	$i++;

}

echo $i;

?>

HTML form to access the data, search by campaign name & keyword


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>GetHourlyReport</title></head><body><form method="get" action="getHourlyStats.php" name="hourstats"><table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>campaign name:</td><td><input name="name"></td></tr><tr><td>keyword:</td><td><input name="keyword"></td></tr></tbody></table><input name="submit" value="submit" type="submit"><br></form></body></html>