Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the visitor cookie timeout #8

Open
yakou32 opened this issue Oct 2, 2019 · 0 comments
Open

Updating the visitor cookie timeout #8

yakou32 opened this issue Oct 2, 2019 · 0 comments

Comments

@yakou32
Copy link

yakou32 commented Oct 2, 2019

Hello,

I would need to add a custom function (paq.push()) in order to update the cookie timeout, following this implementation guideline: https://www.cnil.fr/sites/default/files/typo/document/Configuration_piwik.pdf

I'm quite new to Matomo and Nuxt, some I'm kind of lost to get how to do that...

Here is the code reference to update the original Matomo in-page script:

_paq.push([function() {
var self = this;
function getOriginalVisitorCookieTimeout() {
 var now = new Date(),
 nowTs = Math.round(now.getTime() / 1000),
 visitorInfo = self.getVisitorInfo();
 var createTs = parseInt(visitorInfo[2]);
 var cookieTimeout = 33696000; // 13 months  in seconds
 var originalTimeout = createTs + cookieTimeout - nowTs;
 return originalTimeout;
}
this.setVisitorCookieTimeout( getOriginalVisitorCookieTimeout() );
}]);

I guess I should update the visitor cookie timeout in the middleware:

export default function ({ route }) {
  route.meta.matomo = {
    visitorCookieTimeOut: ['setVisitorCookieTimeout', getOriginalVisitorCookieTimeout()]
  }
}

Would this be the right approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant