How can I tell the PiwikPro to set Cookie Expire to 30 days programmatically

Hello support,

How can I tell the PiwikPro to set Cookie Expires/ Max-Age to 30 days instead of 12 months programmatically? I am not using Tag Manager and I am deploying on my own.

This is the code I use

var _paq = _paq || [];
_paq.push(["trackPageView"]),
  _paq.push(["enableLinkTracking"]),  
  (function () {
    var e = "https://foxscribbler.piwik.pro/";
    _paq.push(["setTrackerUrl", e + "ppms.php"]),
    _paq.push(["setSiteId", "0d96a69e-f206-4b60-9a02-de57294b7f06"]);
  
    var p = document,
      a = p.createElement("script"),
      r = p.getElementsByTagName("script")[0];
    (a.type = "text/javascript"),
      (a.async = !0),
      (a.defer = !0),
      (a.src = e + "ppms.js"),
      r.parentNode.insertBefore(a, r);
  })();

This is the result

Hi @kishorth,

Try using this:

_paq.push(['setVisitorCookieTimeout', 2592000]);

So is my syntax correct?

var _paq = _paq || [];
  _paq.push(["trackPageView"]),
  _paq.push(["enableLinkTracking"]),
  _paq.push(["setVisitorCookieTimeout", 2592000]);
(function () {
  var e = "https://foxscribbler.piwik.pro/";
  _paq.push(["setTrackerUrl", e + "ppms.php"]),
    _paq.push(["setSiteId", "0d96a69e-f206-4b60-9a02-de57294b7f06"]);

  var p = document,
    a = p.createElement("script"),
    r = p.getElementsByTagName("script")[0];
  (a.type = "text/javascript"),
    (a.async = !0),
    (a.defer = !0),
    (a.src = e + "ppms.js"),
    r.parentNode.insertBefore(a, r);
})();

Looks fine to me. It’s worth mentioning that if you previously called disableCookies then you should call enableCookies before setting the cookie lifetime.