diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-10-14 06:02:47 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-10-14 06:02:47 +0400 |
commit | ea508fa62f90ef95ce6c554fc5736b87ca68364f (patch) | |
tree | 3075a46df7afca3f5d9e4b32dc01ad063da69275 /js | |
parent | 20ec0c092792947bcbb28c9937a9421905ce83db (diff) |
refs #6341 do not extend cookie lifetime on each pageload and expire already after 13 months
instead of 24months. This is the now done by default. If you want different
behavior you can call setVisitorCookieTimeout() manually
Diffstat (limited to 'js')
-rw-r--r-- | js/piwik.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/js/piwik.js b/js/piwik.js index 47cea39920..78b9b41ca3 100644 --- a/js/piwik.js +++ b/js/piwik.js @@ -2226,7 +2226,7 @@ if (typeof Piwik !== 'object') { configConversionAttributionFirstReferrer, // Life of the visitor cookie (in milliseconds) - configVisitorCookieTimeout = 63072000000, // 2 years + configVisitorCookieTimeout = 33955200000, // 13 months (365 days + 28days) // Life of the session cookie (in milliseconds) configSessionCookieTimeout = 1800000, // 30 minutes @@ -3956,6 +3956,16 @@ if (typeof Piwik !== 'object') { browserFeatures.res = screenAlias.width * devicePixelRatio + 'x' + screenAlias.height * devicePixelRatio; } + function getRemainingVisitorCookieTimeout() { + var now = new Date(), + nowTs = now.getTime(), + visitorInfo = loadVisitorIdCookie(); + + var createTs = parseInt(visitorInfo[2], 10); + var originalTimeout = (createTs * 1000) + configVisitorCookieTimeout - nowTs; + return originalTimeout; + } + /*<DEBUG>*/ /* * Register a test hook. Using eval() permits access to otherwise @@ -3989,6 +3999,7 @@ if (typeof Piwik !== 'object') { */ detectBrowserFeatures(); updateDomainHash(); + configVisitorCookieTimeout = getRemainingVisitorCookieTimeout(); /*<DEBUG>*/ /* @@ -4055,6 +4066,9 @@ if (typeof Piwik !== 'object') { linkTrackingInstalled = false; linkTrackingEnabled = false; }, + getConfigVisitorCookieTimeout: function () { + return configVisitorCookieTimeout; + }, /*</DEBUG>*/ /** |