Unique session timeout values for each site in Piwik

Hi,

I’m using goals in Piwik to track usage of multiple pieces of software throughout our establishment with each piece of software treated as a unique site. The software being tracked have different inactivity timeout lengths (ranging from 30 seconds to 5 minutes).

So my question is can I set up a Piwik installation to have a different session timeout lengths for different sites?

Cheers,
ben

Currently it is only a “global” setting: http://dev.piwik.org/trac/browser/trunk/config/global.ini.php#L306

Hmmmmm… that’s a shame - thanks for the reply anyway Matt. OK so I guess my next question is…

…is there a way to disable the timeout value and instead end a session through the application itself by sending a value to Piwik?

We want to use the session functionality to get a picture of the number of users (albeit a wooly one as users and sessions are not the same) - does anyone have any other ideas.

Oh and in case it impacts on anyones ideas the applications can be anything from a website to an air app to an open frameworks project.

I had the same Problem. I wrote a simple “hotfix” for that (see below).

You can now have a default session-timeout and one for the site-ids.

eg (config.inc.php):

[Tracker]
visit_standard_length = 1800
visit_standard_length.1 = 7200

This will set a Timeout of 1800 seconds as default and for siteid 1 7200 seconcds.

As i said, simple and hotfix. Maybe that will be possibile in the site-config of the database one day…

Here is the patch (attachment not possible…):

— Visit.php 2012-03-16 11:57:28.000000000 +0100
+++ /var/www/piwik.test/core/Tracker/Visit.php 2012-03-16 11:42:42.000000000 +0100
@@ -376,7 +376,12 @@

	// Will be updated in cookie
	$timeSpentRefererAction = $this->getCurrentTimestamp() - $this->visitorInfo['visit_last_action_time'];
  •   if($timeSpentRefererAction > Piwik_Tracker_Config::getInstance()->Tracker['visit_standard_length'])
    
  •   $visitStandardLength = Piwik_Tracker_Config::getInstance()->Tracker['visit_standard_length.'.$this->idsite];
    
  •   if ($visitStandardLength <= 0) $visitStandardLength=Piwik_Tracker_Config::getInstance()->Tracker['visit_standard_length'];
    
  •   if($timeSpentRefererAction > $visitStandardLength )
      {
      	$timeSpentRefererAction = 0;
      }
    

@@ -941,7 +946,10 @@

	$bindSql = array();
  •   $timeLookBack = date('Y-m-d H:i:s', $this->getCurrentTimestamp() - Piwik_Tracker_Config::getInstance()->Tracker['visit_standard_length']);
    
  •   $visitStandardLength = Piwik_Tracker_Config::getInstance()->Tracker['visit_standard_length.'.$this->idsite];
    
  •   if ($visitStandardLength <= 0) $visitStandardLength=Piwik_Tracker_Config::getInstance()->Tracker['visit_standard_length'];
    
  •   $timeLookBack = date('Y-m-d H:i:s', $this->getCurrentTimestamp() - $visitStandardLength);
    
      // This setting would be enabled for Intranet websites, to ensure that visitors using all the same computer config, same IP
      // are not counted as 1 visitor. In this case, we want to enforce and trust the visitor ID from the cookie.
    

@@ -1230,9 +1238,12 @@
*/
protected function isLastActionInTheSameVisit()
{

  •   $visitStandardLength = Piwik_Tracker_Config::getInstance()->Tracker['visit_standard_length.'.$this->idsite];
    
  •   if ($visitStandardLength <= 0) $visitStandardLength=Piwik_Tracker_Config::getInstance()->Tracker['visit_standard_length'];
    
  •   return isset($this->visitorInfo['visit_last_action_time'])
      			&& ($this->visitorInfo['visit_last_action_time']
    
  •   				> ($this->getCurrentTimestamp() - Piwik_Tracker_Config::getInstance()->Tracker['visit_standard_length']));
    
  •   				> ($this->getCurrentTimestamp() - $visitStandardLength));
    

    }

    /**

Regards,
easy.