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
tracking consent #56
base: master
Are you sure you want to change the base?
tracking consent #56
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments.
32c871b
to
ae4a3d7
Compare
709a7a4
to
7bc1ad2
Compare
type: Boolean, | ||
default: false, | ||
}) | ||
public ignoreDoNotTrack: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a good idea to make this a setting in the first place? Shouldn't we respect this setting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do respect this setting by default. But if someone want to not respect it, then he's free to do so. (see Daniel's comment #56 (comment))
src/components/TrackingConsent.vue
Outdated
const cookie = [cookieName + '=' + cookieValue]; | ||
|
||
if (options) { | ||
if (!options.domain) options.domain = TrackingConsent.DEFAULT_COOKIE_DOMAIN; | ||
if (!options.expirationDays) options.expirationDays = TrackingConsent.DEFAULT_COOKIE_EXPIRATION_DAYS; | ||
|
||
cookie.push('domain=' + options.domain); | ||
cookie.push('max-age=' + options.expirationDays * 24 * 60 * 60); | ||
} | ||
|
||
cookie.push('path=/'); | ||
document.cookie = cookie.join(';'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this needs the sameSite
setting as well nowadays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SameSite
require Secure
sometimes, so i'll add both 👍
export const LOCALSTORAGE_KEYS = [ | ||
'tracking-consent', | ||
'tracking-consensus', | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why two keys? Maybe add a comment to explain.
src/components/TrackingConsent.vue
Outdated
export const COOKIE_STORAGE_KEY = 'tracking-consent'; | ||
|
||
export const DEFAULT_COOKIE_DOMAIN = document.location.hostname; | ||
export const DEFAULT_COOKIE_EXPIRATION_DAYS = 365 * 20; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
20 years? 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually let me change it to 10 years, because 20 years won't work on 32bits systems.
Requested changes by Sisou #56 (review) - `options.setSiteId` doesn’t have a default value anymore, and is now required - Renamed `DEFAULT_TRACKING_URL` to `DEFAULT_TRACKING_SCRIPT_URL` - Moved the default `geoIpServer` value to a constant named `DEFAULT_GEOIP_SERVER_URL` - Added possibility to set the cookie's attributes `secure` and `sameSite` - Added a comment explaining the two `localStorage` keys - Changed default lifetime of the cookie from 20 years to 10 years since 20 years would not work on 32bits systems. (the cookie would just disappear instantly)
PR #56 Requested changes by Sisou #56 (review) - `options.setSiteId` doesn’t have a default value anymore, and is now required - Renamed `DEFAULT_TRACKING_URL` to `DEFAULT_TRACKING_SCRIPT_URL` - Moved the default `geoIpServer` value to a constant named `DEFAULT_GEOIP_SERVER_URL` - Added possibility to set the cookie's attributes `secure` and `sameSite` - Added a comment explaining the two `localStorage` keys - Changed default lifetime of the cookie from 20 years to 10 years since 20 years would not work on 32bits systems. (the cookie would just disappear instantly)
8f88ad4
to
397ddb7
Compare
- turn public methods into static ones - turn "domain" prop into static const
- PR requested changes - Listening for tab / window focus in case the user allows tracking on another tab / window or change browser settings / vpn ToDo: - Should use BottomOverlay - Component doc comment
- types fix - setTrackerUrl & trackingScriptUrl urls fix - add default setTrackerUrl value - now using a window `focus` listener instead of document `visibilitychange` one
…null and string[] as options value’s type
PR #56 Requested changes by Sisou #56 (review) - `options.setSiteId` doesn’t have a default value anymore, and is now required - Renamed `DEFAULT_TRACKING_URL` to `DEFAULT_TRACKING_SCRIPT_URL` - Moved the default `geoIpServer` value to a constant named `DEFAULT_GEOIP_SERVER_URL` - Added possibility to set the cookie's attributes `secure` and `sameSite` - Added a comment explaining the two `localStorage` keys - Changed default lifetime of the cookie from 20 years to 10 years since 20 years would not work on 32bits systems. (the cookie would just disappear instantly)
397ddb7
to
05cefe2
Compare
- now loading Matomo tracking script before checking for UI requirement, but disable cookie usage before user give consent (if in EEA) - removed `allowBrowserData` since we’re tracking browser data by default, without asking for consent - fixed `geoIpServer` @prop default value - now checking if `_paq` & `_mtm` are objects that have a `push` method, instead of checking if they’re Arrays (since they’re not Arrays, but objects with a single `push` method) - removed the public static getter `allowsBrowserData` and the public static method `allowBrowserData ` - added a static public getter `isOutsideEEA`, since we can enable Cookies without consent for countries outside the EEA - turned the `execFunction` method into a async one, allowing to `await` for the function result
- add a `trackPageView` public static method for easy page tracking on single-page apps - set trackPageView by default to track first page view
13fefd4
to
05af0f1
Compare
This Pr add the TrackingConsent component, used to setup matomo tracking easily.
You can try it locally in the wallet, branch
matheo/matomo_tracking
, or using "Curd's Fancy Deployment Selector".