You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the JS tracker code that looks something like this:
var _paq = _paq || [];
_paq.push(['setSessionCookieTimeout', 7200]);
_paq.push(['trackPageView']);
var matomoload = (function () {
var u = "//" + g_strMatomoURL + "/";
_paq.push(['setTrackerUrl', u + 'piwik.php']);
_paq.push(['setSiteId', g_strMatomoSiteID]);
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript'; g.async = true; g.defer = true; g.src = u + 'piwik.js';
s.parentNode.insertBefore(g, s);
});
if (window.addEventListener) { window.addEventListener("load", matomoload, false); }
else if (window.attachEvent) { window.attachEvent("onload",matomoload); }
Despite the "setSessionCookieTimeout" call, the _pk_ses cookie is created with a 30 minute expiration (as per the default). Since this is not a SPA, every page keeps updating the cookie with the 30 minute expiration. However, if I add "setSessionCookieTimeout" to the applyFirst array in piwik.js, then the cookie is created with the 2 hour expiration as desired. Is that a bug, or do I misunderstand the intent of setSessionCookieTimeout and applyFirst?
On a related note, I'm struggling to understand what expiration of _pk_ses actually controls. I changed visit_standard_length to 2 hours in the config.ini.php file and that seems to do what I expect without the JS setSessionCookieTimeout call. Even if I delete the _pk_ses cookie, the original visit is still continued on the next page navigation. In case it matters, I also have trust_visitors_cookies = 1.
Thanks a lot.
-Igor
The text was updated successfully, but these errors were encountered:
Great, thank you! Do you have a sense of what exactly won't work correctly in my setup if visit_standard_length is 2 hours, but the session cookie timeout is 30 minutes?
Good question, I think it would increase the visit count more often and possibly play up a little bit with the "last known referrer" but not sure how much that would actually effect it.
Hi Everyone,
I have the JS tracker code that looks something like this:
Despite the "setSessionCookieTimeout" call, the _pk_ses cookie is created with a 30 minute expiration (as per the default). Since this is not a SPA, every page keeps updating the cookie with the 30 minute expiration. However, if I add "setSessionCookieTimeout" to the applyFirst array in piwik.js, then the cookie is created with the 2 hour expiration as desired. Is that a bug, or do I misunderstand the intent of setSessionCookieTimeout and applyFirst?
On a related note, I'm struggling to understand what expiration of _pk_ses actually controls. I changed visit_standard_length to 2 hours in the config.ini.php file and that seems to do what I expect without the JS setSessionCookieTimeout call. Even if I delete the _pk_ses cookie, the original visit is still continued on the next page navigation. In case it matters, I also have trust_visitors_cookies = 1.
Thanks a lot.
-Igor
The text was updated successfully, but these errors were encountered: