diff options
author | diosmosis <benaka@piwik.pro> | 2015-06-06 09:40:26 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-06-25 14:13:34 +0300 |
commit | d10b204a678a3285e6ecc513580ec7d201de8667 (patch) | |
tree | 40c9140424958d667701d7c167a6deaa7c8fa614 /core/Tracker/Visit.php | |
parent | d94551c4f33756f8245acd9fb9720382ae997f55 (diff) |
Adding server side logic for ping requests that specify a visit is still ongoing, w/o creating a new action. Includes a new integration test for the feature.
Diffstat (limited to 'core/Tracker/Visit.php')
-rw-r--r-- | core/Tracker/Visit.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php index 2ae3e0677d..6a33b93f52 100644 --- a/core/Tracker/Visit.php +++ b/core/Tracker/Visit.php @@ -158,6 +158,14 @@ class Visit implements VisitInterface $isNewVisit = $this->isVisitNew($visitor, $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 + if ($this->isPingRequest() + && !$isNewVisit + ) { + $action = null; + } + // Known visit when: // ( - the visitor has the Piwik cookie with the idcookie ID used by Piwik to match the visitor // OR @@ -700,4 +708,9 @@ class Visit implements VisitInterface return $site['timezone']; } } + + private function isPingRequest() + { + return $this->request->getParam('ping') == 1; + } } |