Skip to content
Extraits de code Groupes Projets
Valider 27cc5369 rédigé par diosmosis's avatar diosmosis
Parcourir les fichiers

Tweaking PingRequestProcessor, filling out missing docs and removing TODO from VisitTest.php.

parent 3f0511c4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -18,7 +18,8 @@ class Settings // TODO: merge w/ visitor recognizer or make it it's own service. ...@@ -18,7 +18,8 @@ class Settings // TODO: merge w/ visitor recognizer or make it it's own service.
const OS_BOT = 'BOT'; const OS_BOT = 'BOT';
/** /**
* TODO * If `true`, the config ID for a visitor will be the same no matter what site is being tracked.
* If `false, the config ID will be different.
* *
* @var bool * @var bool
*/ */
......
...@@ -15,55 +15,52 @@ use Piwik\Plugins\CustomVariables\CustomVariables; ...@@ -15,55 +15,52 @@ use Piwik\Plugins\CustomVariables\CustomVariables;
use Piwik\Tracker\Visit\VisitProperties; use Piwik\Tracker\Visit\VisitProperties;
/** /**
* TODO * Tracker service that finds the last known visit for the visitor being tracked.
*/ */
class VisitorRecognizer class VisitorRecognizer
{ {
/** /**
* TODO * Local variable cache for the getVisitFieldsPersist() method.
* *
* @var array * @var array
*/ */
private $visitFieldsToSelect; private $visitFieldsToSelect;
/** /**
* TODO * See http://piwik.org/faq/how-to/faq_175/.
* *
* @var bool * @var bool
*/ */
private $trustCookiesOnly; private $trustCookiesOnly;
/** /**
* TODO * Length of a visit in seconds.
* *
* @var int * @var int
*/ */
private $visitStandardLength; private $visitStandardLength;
/** /**
* TODO * Number of seconds that have to pass after an action before a new action from the same visitor is
* considered a new visit. Defaults to $visitStandardLength.
* *
* @var int * @var int
*/ */
private $lookBackNSecondsCustom; private $lookBackNSecondsCustom;
/** /**
* TODO * Forces all requests to result in new visits. For debugging only.
* *
* @var int * @var int
*/ */
private $trackerAlwaysNewVisitor; private $trackerAlwaysNewVisitor;
/** /**
* TODO
*
* @var Model * @var Model
*/ */
private $model; private $model;
/** /**
* TODO
*
* @var EventDispatcher * @var EventDispatcher
*/ */
private $eventDispatcher; private $eventDispatcher;
...@@ -80,15 +77,6 @@ class VisitorRecognizer ...@@ -80,15 +77,6 @@ class VisitorRecognizer
$this->eventDispatcher = $eventDispatcher; $this->eventDispatcher = $eventDispatcher;
} }
/**
* This methods tries to see if the visitor has visited the website before.
*
* We have to split the visitor into one of the category
* - Known visitor
* - New visitor
*
* TODO: move docs to class docs
*/
public function findKnownVisitor($configId, VisitProperties $visitProperties, Request $request) public function findKnownVisitor($configId, VisitProperties $visitProperties, Request $request)
{ {
$idSite = $request->getIdSite(); $idSite = $request->getIdSite();
......
...@@ -19,22 +19,14 @@ use Piwik\Tracker\Visit\VisitProperties; ...@@ -19,22 +19,14 @@ use Piwik\Tracker\Visit\VisitProperties;
*/ */
class PingRequestProcessor extends RequestProcessor class PingRequestProcessor extends RequestProcessor
{ {
public function processRequestParams(VisitProperties $visitProperties, Request $request) public function afterRequestProcessed(VisitProperties $visitProperties, Request $request)
{ {
if ($this->isPingRequest($request)) { if ($this->isPingRequest($request)) {
// on a ping request that is received before the standard visit length, we just update the visit time w/o adding a new action // on a ping request that is received before the standard visit length, we just update the visit time w/o adding a new action
Common::printDebug("-> ping=1 request: we do not track a new action nor a new visit nor any goal."); Common::printDebug("-> ping=1 request: we do not track a new action nor a new visit nor any goal.");
$visitProperties->setRequestMetadata('Actions', 'action', null); $visitProperties->setRequestMetadata('Actions', 'action', null);
}
}
public function afterRequestProcessed(VisitProperties $visitProperties, Request $request)
{
if ($this->isPingRequest($request)) {
$visitProperties->setRequestMetadata('Goals', 'someGoalsConverted', false); $visitProperties->setRequestMetadata('Goals', 'someGoalsConverted', false);
$visitProperties->setRequestMetadata('Goals', 'visitIsConverted', false); $visitProperties->setRequestMetadata('Goals', 'visitIsConverted', false);
// TODO: double check: can this be merged w/ setting action to null?
// When a ping request is received more than 30 min after the last request/ping, // When a ping request is received more than 30 min after the last request/ping,
// we choose not to create a new visit. // we choose not to create a new visit.
......
...@@ -23,8 +23,6 @@ use Piwik\Tests\Framework\TestCase\IntegrationTestCase; ...@@ -23,8 +23,6 @@ use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
/** /**
* @group Core * @group Core
*
* TODO: move isVisitNew tests to CoreHome plugin
*/ */
class VisitTest extends IntegrationTestCase class VisitTest extends IntegrationTestCase
{ {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter