diff options
author | diosmosis <benaka@piwik.pro> | 2015-06-17 03:35:15 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-06-25 14:13:35 +0300 |
commit | b2667ba7998db959ac8eb468c5e8303c9522d1cf (patch) | |
tree | 8cc1582f7177a9e36628a135fb4f157639b9f6dc /js | |
parent | 1deea271377ce7342efc831296624874a7f9a703 (diff) |
Do not ignore ping requests when checking the last tracker request time, since we should ping N seconds after last ping also. And if tracking request is sent before heart beat timer is configured, setup heart beat when configuring heart beat timer.
Diffstat (limited to 'js')
-rw-r--r-- | js/piwik.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/js/piwik.js b/js/piwik.js index 36baeda422..0b16fd7092 100644 --- a/js/piwik.js +++ b/js/piwik.js @@ -2293,7 +2293,7 @@ if (typeof Piwik !== 'object') { heartBeatSetUp = false, // Timestamp of last tracker request sent to Piwik - lastTrackerRequestTime, + lastTrackerRequestTime = null, // Handle to the current heart beat timeout heartBeatTimeout, @@ -2582,9 +2582,7 @@ if (typeof Piwik !== 'object') { * Send request */ function sendRequest(request, delay, callback) { - if (request.indexOf('ping=') === -1) { - lastTrackerRequestTime = (new Date()).getTime(); - } + lastTrackerRequestTime = (new Date()).getTime(); if (!configDoNotTrack && request) { makeSureThereIsAGapAfterFirstTrackingRequestToPreventMultipleVisitorCreation(function () { @@ -5007,6 +5005,11 @@ if (typeof Piwik !== 'object') { */ setHeartBeatTimer: function (heartBeatDelay) { configHeartBeatDelay = (heartBeatDelay || 15) * 1000; + + // if a tracking request has already been set, start the heart beat timeout + if (lastTrackerRequestTime !== null) { + setUpHeartBeat(); + } }, /** |