Closed matthew-white closed 4 years ago
According to https://www.chromium.org/updates/same-site, Google has started enforcing SameSite settings in Chrome.
According to https://www.simoahava.com/analytics/cookieflags-field-google-analytics/, we can add the following to news.html to fix this issue.
ga('create', 'UA-XXXXX-Y', {
cookieFlags: 'secure;samesite=none'
});
I bet this will also be an issue for https://github.com/getodk/xlsform-online. @matthew-white can you try this change and see if it fixes it?
After making a change along these lines, the cookie was stored. 🎉 I've pushed the PR #166 with this change.
My sense is that the reason we need to specify SameSite=None
is because we use a cross-site iframe. If/when we add more analytics and move that out of the iframe, we might not need to specify SameSite=None
.
I bet this will also be an issue for https://github.com/getodk/xlsform-online.
When I navigate to https://getodk.org/xlsform/ in Chrome, I actually do see analytics cookies, under both https://getodk.org and https://xlsform.getodk.org. The Domain attribute of these cookies is .getodk.org. Maybe it works because the iframe is the same domain? Also, according to Cookies and user identification with gtag.js:
By default, gtag.js has automatic cookie domain configuration enabled. When enabled, gtag.js will set cookies on the highest level domain it can. For example, if your website address is
blog.example.com
, gtag.js will set cookies on theexample.com
domain.
I'm seeing the following console warning in Chrome:
I don't think an existing cookie will be removed, but I think a new cookie will no longer be added. When I log into the sandbox on Chrome and look at my cookies, I do not see an analytics cookie.