Hello community,
I tried to use the new setSecureCookie method for https only sites, but can’t get it working.
First there is a difference between the API documentation and piwik.js:
API Doc: setSecureCookies( book )
piwik.js: setSecureCookie( bool ), default = false
So I assumed typos and added the second version to my tracking code:
var _paq = _paq || [];
_paq.push(['setVisitorCookieTimeout', '604800']);
_paq.push(['setSecureCookie', true]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() { var u="https://piwik.example.com/";
_paq.push(['setTrackerUrl', u+'js/']); _paq.push(['setSiteId', 123]); 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+'js/'; s.parentNode.insertBefore(g,s); })();
But it didn’t work and the Developer Console showed the error:
The method ‘setSecureCookie’ was not found in “_paq” variable
Did I get something completely wrong or is it a bug?
I installed the 3 files from the Pull request in my Piwik Test Environment and it works.
With the tracking code above, the pk_ Cookies Details show now “Send for: Encrypted connections only”
Verified in Chrome 62 and Firefox ESR 52. There seems to be no way to view theDetaill in IE, but then - nobody can complain about it.