diff --git a/mon-entreprise/source/ATInternetTracking/Tracker.ts b/mon-entreprise/source/ATInternetTracking/Tracker.ts
index 0019dad02..b9f42369d 100644
--- a/mon-entreprise/source/ATInternetTracking/Tracker.ts
+++ b/mon-entreprise/source/ATInternetTracking/Tracker.ts
@@ -43,6 +43,7 @@ export interface ATTracker {
privacy: {
setVisitorMode(authority: 'cnil', type: 'exempt'): void
setVisitorOptout(): void
+ getVisitorMode(): { name: 'exempt' | 'optout' }
}
dispatch(): void
}
@@ -55,7 +56,7 @@ declare global {
}
}
-export function createTracker(siteId?: string) {
+export function createTracker(siteId?: string, doNotTrack = false) {
const site = siteId ? +siteId : 0
if (Number.isNaN(site)) {
throw new Error('expect string siteId to be of number form')
@@ -75,18 +76,11 @@ export function createTracker(siteId?: string) {
this.site[
INDICATOR.SITE.LANGAGE
] = `[${options.language}]` as CustomSiteIndicator[1]
- this.privacy.setVisitorMode('cnil', 'exempt')
- if (
- process.env.NODE_ENV === 'production' &&
- (document.cookie
- .split(';')
- // We use Matomo cookie while it's here
- .find((cookie) => cookie.startsWith('mtm_consent_removed')) ||
- navigator.doNotTrack === '1')
- ) {
+ if (process.env.NODE_ENV === 'production' && doNotTrack) {
this.privacy.setVisitorOptout()
+ } else {
+ this.privacy.setVisitorMode('cnil', 'exempt')
}
- this.dispatch()
}
dispatch() {
@@ -123,6 +117,10 @@ export class Log implements ATTracker {
setVisitorOptout() {
console.debug('ATTracker::setVisitorOptout')
},
+ getVisitorMode() {
+ console.debug('ATTracker::privacy.getVisitorMode')
+ return { name: 'exempt' }
+ },
}
dispatch(): void {
console.debug('ATTracker::dispatch')
diff --git a/mon-entreprise/source/Provider.tsx b/mon-entreprise/source/Provider.tsx
index 54573bf7a..ce33d4472 100644
--- a/mon-entreprise/source/Provider.tsx
+++ b/mon-entreprise/source/Provider.tsx
@@ -18,9 +18,17 @@ import {
// ATInternet Tracking
import { TrackingContext } from './ATInternetTracking'
import { createTracker } from './ATInternetTracking/Tracker'
+import safeLocalStorage from './storage/safeLocalStorage'
import { inIframe } from './utils'
-const ATTracker = createTracker(process.env.AT_INTERNET_SITE_ID)
+const ATTracker = createTracker(
+ process.env.AT_INTERNET_SITE_ID,
+ !!JSON.parse(
+ safeLocalStorage.getItem('tracking:do_not_track') ??
+ navigator.doNotTrack ??
+ 'false'
+ )
+)
declare global {
interface Window {
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__: any
diff --git a/mon-entreprise/source/components/layout/Footer/Privacy.tsx b/mon-entreprise/source/components/layout/Footer/Privacy.tsx
index 7b9eadd1b..0becb215c 100644
--- a/mon-entreprise/source/components/layout/Footer/Privacy.tsx
+++ b/mon-entreprise/source/components/layout/Footer/Privacy.tsx
@@ -1,7 +1,8 @@
import Overlay from 'Components/Overlay'
-import { useState } from 'react'
-import { Trans, useTranslation } from 'react-i18next'
-import { TrackPage } from '../../../ATInternetTracking'
+import { useCallback, useContext, useState } from 'react'
+import { Trans } from 'react-i18next'
+import { TrackingContext, TrackPage } from '../../../ATInternetTracking'
+import safeLocalStorage from '../../../storage/safeLocalStorage'
export default function Privacy({ label }: { label?: string }) {
const [opened, setOpened] = useState(false)
@@ -28,7 +29,22 @@ export default function Privacy({ label }: { label?: string }) {
}
function PrivacyContent() {
- const { language } = useTranslation().i18n
+ const tracker = useContext(TrackingContext)
+ const [valueChanged, setValueChanged] = useState(false)
+ const handleChange = useCallback(
+ (evt) => {
+ if (evt.target.checked) {
+ tracker.privacy.setVisitorOptout()
+ safeLocalStorage.setItem('tracking:do_not_track', 'true')
+ } else {
+ tracker.privacy.setVisitorMode('cnil', 'exempt')
+ safeLocalStorage.setItem('tracking:do_not_track', 'false')
+ }
+ setValueChanged(true)
+ },
+ [setValueChanged, tracker.privacy]
+ )
+
return (
<>
@@ -46,17 +62,30 @@ function PrivacyContent() {
Vous pouvez vous soustraire de cette mesure d'utilisation du site
- ci-dessous.
+ ci-dessous :
+
+
+
-
+ {valueChanged && (
+
+
+ Vos préférences ont bien été enregistrées
+
+
+ )}
>
)
}
diff --git a/mon-entreprise/source/locales/ui-en.yaml b/mon-entreprise/source/locales/ui-en.yaml
index 744a2a7d0..92ca5945d 100644
--- a/mon-entreprise/source/locales/ui-en.yaml
+++ b/mon-entreprise/source/locales/ui-en.yaml
@@ -1356,16 +1356,491 @@ pour les accidents de trajet/travail et maladie pro: for commuting accidents, wo
previousSimulationBanner:
info: Your previous simulation data have been saved.
retrieveButton: Retrieve my last simulation
-privacyContent: |
- <0>$t(Vie privée)0> <1>
- We do not store any personal data on our servers. All the information
- you provide (salaries, company postal code, SIREN etc.) is saved only
- on your browser. No one else can have access to it but you.
- 1> <2>
- However, we do collect anonymous statistics on site usage, which we use
- for the sole purpose of improving the service, in accordance with the
- <2>recommendations of the CNIL2> and the DPRG directive.
- 2> <3>You can opt out below.3>
+privacyContent:
+ "0": <
+ "1": "0"
+ "10": p
+ "100": y
+ "101": o
+ "102": u
+ "103": " "
+ "104": p
+ "105": r
+ "106": o
+ "107": v
+ "108": i
+ "109": d
+ "11": r
+ "110": e
+ "111": " "
+ "112": (
+ "113": s
+ "114": a
+ "115": l
+ "116": a
+ "117": r
+ "118": i
+ "119": e
+ "12": i
+ "120": s
+ "121": ","
+ "122": " "
+ "123": c
+ "124": o
+ "125": m
+ "126": p
+ "127": a
+ "128": n
+ "129": y
+ "13": v
+ "130": " "
+ "131": p
+ "132": o
+ "133": s
+ "134": t
+ "135": a
+ "136": l
+ "137": " "
+ "138": c
+ "139": o
+ "14": é
+ "140": d
+ "141": e
+ "142": ","
+ "143": " "
+ "144": S
+ "145": I
+ "146": R
+ "147": E
+ "148": N
+ "149": " "
+ "15": e
+ "150": e
+ "151": t
+ "152": c
+ "153": .
+ "154": )
+ "155": " "
+ "156": i
+ "157": s
+ "158": " "
+ "159": s
+ "16": )
+ "160": a
+ "161": v
+ "162": e
+ "163": d
+ "164": " "
+ "165": o
+ "166": n
+ "167": l
+ "168": y
+ "169": "\n"
+ "17": <
+ "170": " "
+ "171": " "
+ "172": o
+ "173": n
+ "174": " "
+ "175": y
+ "176": o
+ "177": u
+ "178": r
+ "179": " "
+ "18": /
+ "180": b
+ "181": r
+ "182": o
+ "183": w
+ "184": s
+ "185": e
+ "186": r
+ "187": .
+ "188": " "
+ "189": N
+ "19": "0"
+ "190": o
+ "191": " "
+ "192": o
+ "193": n
+ "194": e
+ "195": " "
+ "196": e
+ "197": l
+ "198": s
+ "199": e
+ "2": ">"
+ "20": ">"
+ "200": " "
+ "201": c
+ "202": a
+ "203": n
+ "204": " "
+ "205": h
+ "206": a
+ "207": v
+ "208": e
+ "209": " "
+ "21": " "
+ "210": a
+ "211": c
+ "212": c
+ "213": e
+ "214": s
+ "215": s
+ "216": " "
+ "217": t
+ "218": o
+ "219": " "
+ "22": <
+ "220": i
+ "221": t
+ "222": " "
+ "223": b
+ "224": u
+ "225": t
+ "226": " "
+ "227": y
+ "228": o
+ "229": u
+ "23": "1"
+ "230": .
+ "231": "\n"
+ "232": <
+ "233": /
+ "234": "1"
+ "235": ">"
+ "236": " "
+ "237": <
+ "238": "2"
+ "239": ">"
+ "24": ">"
+ "240": "\n"
+ "241": " "
+ "242": " "
+ "243": H
+ "244": o
+ "245": w
+ "246": e
+ "247": v
+ "248": e
+ "249": r
+ "25": "\n"
+ "250": ","
+ "251": " "
+ "252": w
+ "253": e
+ "254": " "
+ "255": d
+ "256": o
+ "257": " "
+ "258": c
+ "259": o
+ "26": " "
+ "260": l
+ "261": l
+ "262": e
+ "263": c
+ "264": t
+ "265": " "
+ "266": a
+ "267": n
+ "268": o
+ "269": n
+ "27": " "
+ "270": y
+ "271": m
+ "272": o
+ "273": u
+ "274": s
+ "275": " "
+ "276": s
+ "277": t
+ "278": a
+ "279": t
+ "28": W
+ "280": i
+ "281": s
+ "282": t
+ "283": i
+ "284": c
+ "285": s
+ "286": " "
+ "287": o
+ "288": n
+ "289": " "
+ "29": e
+ "290": s
+ "291": i
+ "292": t
+ "293": e
+ "294": " "
+ "295": u
+ "296": s
+ "297": a
+ "298": g
+ "299": e
+ "3": $
+ "30": " "
+ "300": ","
+ "301": " "
+ "302": w
+ "303": h
+ "304": i
+ "305": c
+ "306": h
+ "307": " "
+ "308": w
+ "309": e
+ "31": d
+ "310": " "
+ "311": u
+ "312": s
+ "313": e
+ "314": "\n"
+ "315": " "
+ "316": " "
+ "317": f
+ "318": o
+ "319": r
+ "32": o
+ "320": " "
+ "321": t
+ "322": h
+ "323": e
+ "324": " "
+ "325": s
+ "326": o
+ "327": l
+ "328": e
+ "329": " "
+ "33": " "
+ "330": p
+ "331": u
+ "332": r
+ "333": p
+ "334": o
+ "335": s
+ "336": e
+ "337": " "
+ "338": o
+ "339": f
+ "34": n
+ "340": " "
+ "341": i
+ "342": m
+ "343": p
+ "344": r
+ "345": o
+ "346": v
+ "347": i
+ "348": n
+ "349": g
+ "35": o
+ "350": " "
+ "351": t
+ "352": h
+ "353": e
+ "354": " "
+ "355": s
+ "356": e
+ "357": r
+ "358": v
+ "359": i
+ "36": t
+ "360": c
+ "361": e
+ "362": ","
+ "363": " "
+ "364": i
+ "365": n
+ "366": " "
+ "367": a
+ "368": c
+ "369": c
+ "37": " "
+ "370": o
+ "371": r
+ "372": d
+ "373": a
+ "374": n
+ "375": c
+ "376": e
+ "377": " "
+ "378": w
+ "379": i
+ "38": s
+ "380": t
+ "381": h
+ "382": " "
+ "383": t
+ "384": h
+ "385": e
+ "386": "\n"
+ "387": " "
+ "388": " "
+ "389": <
+ "39": t
+ "390": "2"
+ "391": ">"
+ "392": r
+ "393": e
+ "394": c
+ "395": o
+ "396": m
+ "397": m
+ "398": e
+ "399": n
+ "4": t
+ "40": o
+ "400": d
+ "401": a
+ "402": t
+ "403": i
+ "404": o
+ "405": n
+ "406": s
+ "407": " "
+ "408": o
+ "409": f
+ "41": r
+ "410": " "
+ "411": t
+ "412": h
+ "413": e
+ "414": " "
+ "415": C
+ "416": N
+ "417": I
+ "418": L
+ "419": <
+ "42": e
+ "420": /
+ "421": "2"
+ "422": ">"
+ "423": " "
+ "424": a
+ "425": n
+ "426": d
+ "427": " "
+ "428": t
+ "429": h
+ "43": " "
+ "430": e
+ "431": " "
+ "432": D
+ "433": P
+ "434": R
+ "435": G
+ "436": " "
+ "437": d
+ "438": i
+ "439": r
+ "44": a
+ "440": e
+ "441": c
+ "442": t
+ "443": i
+ "444": v
+ "445": e
+ "446": .
+ "447": "\n"
+ "448": <
+ "449": /
+ "45": n
+ "450": "2"
+ "451": ">"
+ "452": " "
+ "453": <
+ "454": "3"
+ "455": ">"
+ "456": Y
+ "457": o
+ "458": u
+ "459": " "
+ "46": y
+ "460": c
+ "461": a
+ "462": n
+ "463": " "
+ "464": o
+ "465": p
+ "466": t
+ "467": " "
+ "468": o
+ "469": u
+ "47": " "
+ "470": t
+ "471": " "
+ "472": b
+ "473": e
+ "474": l
+ "475": o
+ "476": w
+ "477": .
+ "478": <
+ "479": /
+ "48": p
+ "480": "3"
+ "481": ">"
+ "482": "\n"
+ "49": e
+ "5": (
+ "50": r
+ "51": s
+ "52": o
+ "53": n
+ "54": a
+ "55": l
+ "56": " "
+ "57": d
+ "58": a
+ "59": t
+ "6": V
+ "60": a
+ "61": " "
+ "62": o
+ "63": n
+ "64": " "
+ "65": o
+ "66": u
+ "67": r
+ "68": " "
+ "69": s
+ "7": i
+ "70": e
+ "71": r
+ "72": v
+ "73": e
+ "74": r
+ "75": s
+ "76": .
+ "77": " "
+ "78": A
+ "79": l
+ "8": e
+ "80": l
+ "81": " "
+ "82": t
+ "83": h
+ "84": e
+ "85": " "
+ "86": i
+ "87": n
+ "88": f
+ "89": o
+ "9": " "
+ "90": r
+ "91": m
+ "92": a
+ "93": t
+ "94": i
+ "95": o
+ "96": n
+ "97": "\n"
+ "98": " "
+ "99": " "
+ ok: Your preferences have been saved
quicklinks:
Avantages: Benefits
CDD: Fixed-term