@samuel-lobby opened this Issue on September 16th 2021

Hello all,

The iframe I added for the opt out works fine, at least as far as tracking is concerned. If I click on the checkbox it is unchecked and the text of the iframe changes after a reload of the page. If I reload the page again, the "old" text is displayed plus the checkbox is checked again.
However, the cookie for the opt out is set correctly and also works correctly.
But I would like the checkbox and the text to remain after an opt out. Do I have to set anything extra for this or is this a bug?

Thank's a lot and best regards,
Samuel

@Findus23 commented on September 16th 2021 Member

Just a wild guess:
Is your iFrame embedded into a different domain as the one Matomo uses and do you have a browser with third party cookies disabled (like Chrom(e|ium) by default?

@samuel-lobby commented on September 17th 2021

The Matomo is used on a subdomain of the main domain.
I first thought it was the cookie banner, but that doesn't seem to be the problem. I set these two necessary cookies:

  • MATOMO_SESSID
  • mtm_consent_removed

In Matomo I deactivated tracking with cookies maybe that's also an important information.

@tsteur commented on September 19th 2021 Member

Is there any chance you could post a URL to the page where we can reproduce this? It be otherwise hard to reproduce or guess what the problem might be @samuel-lobby

@samuel-lobby commented on September 20th 2021

@tsteur sure, here is the link to the privacy policy: https://www.hs-doepfer.de/datenschutz
Here I've implemented the opt out iframe. I hope this can be clarified as soon as possible.

@tsteur commented on September 20th 2021 Member

Tested eg https://analytics.hs-doepfer.de/index.php?module=CoreAdminHome&action=optOut&language=de&setCookieInNewWindow=1&nonce=NONCE&time=1632171100302

It was trying to set an ignore cookie
image

but it wasn't set afterwards somehow. Nothing related in the logs, no issues.

Not sure what the problem might be.

@samuel-lobby I think you might not be using the latest version of Matomo? Is there any chance you could upgrade to see if that fixes it maybe?

@samuel-lobby commented on September 21st 2021

@tsteur I use Matomo 4.4.1. I made the update to this version after I recognized that this opt out iframe isn't working as it should. So maybe the cookie matomo_ignore is blocked from the cookie consent mananger?

@Findus23 commented on September 21st 2021 Member

@tsteur After checking myself, I noticed the reason why the cookie isn't set: The expiration date is expires=Mon, 09-Aug-1915 07:50:25 GMT; secure; SameSite=None.

@samuel-lobby commented on September 21st 2021

@Findus23 you're right. Why is this happening? Can I control this expiration date?

@Findus23 commented on September 21st 2021 Member

Matomo sets the expiration date to 30 years from now:
https://github.com/matomo-org/matomo/blob/fd1d68cbaac5c8a44aaab335700eba8f3723c754/core/Tracker/IgnoreCookie.php#L59

So for a starter you could check the output of this PHP script:


<?php
var_dump(time());
var_dump(time() + (86400 * 365 * 30));
@Findus23 commented on September 21st 2021 Member

But it is most likely a 32 bit overflow somewhere:
30 years from now is 2578918957 in unix time.
2578918957- 2^32 = -1716048339 and -1716048339 in unix time is in August 1915.

So can you describe your server setup a bit more? Which operating system are you using? Which PHP version?

@samuel-lobby commented on September 21st 2021

@Findus23
the crm system: TYPO3 (9.5)
PHP version: 7.2.34
The Website is hosted at Domainfactory.
Do you need some more infos?

@tsteur commented on September 21st 2021 Member

I suppose this means we might also need to change other places? If I see this right the only thing we maybe can do about this add a system check mentioning 64 bit system / PHP required?

We could possibly make it work for this particular case to generate a date in 30+ years using something like str_replace('current year', 'current year +30 years', Date::now()->getDatetime()) if we could pass string as expires in the cookie method.

But generally there might be other places where there are also issues?

@samuel-lobby commented on September 23rd 2021

@tsteur what can I do in the meantime? Or do I have to wait until it's released with an update of matomo?

@tsteur commented on September 23rd 2021 Member

@samuel-lobby is there any chance you can ask your hoster if they can update your site to a 64 bit system?

To fix this specific issue maybe we can refactor the opt out cookie to calculate 30 years in the future differently instead of using a timestamp etc use something like this (pseudo code) str_replace('current year', 'current year +30 years', Date::now()->getDatetime().

@tsteur commented on October 7th 2021 Member

The goal of this issue is to make the opt out work when a PHP 32 bit is used see https://github.com/matomo-org/matomo/issues/18019#issuecomment-924360242

This Issue was closed on October 26th 2021
Powered by GitHub Issue Mirror