From 5c3ee00832ff8f29129accc6015431a86acdeade Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Fri, 6 Mar 2020 11:10:56 +0100 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=90=9B=20Retire=20une=20question=20vi?= =?UTF-8?q?de?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publicode/rules/salarié.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publicode/rules/salarié.yaml b/publicode/rules/salarié.yaml index 611e5a2a2..ee5abbe78 100644 --- a/publicode/rules/salarié.yaml +++ b/publicode/rules/salarié.yaml @@ -240,7 +240,7 @@ contrat salarié . déduction forfaitaire spécifique . application: déduction afin d'accorder plus de droits au salarié, notamment en terme de retraite et d'assurance chômage. titre: application de la DFS - par défaut: oui + formule: oui contrat salarié . CDD . taxe forfaitaire sur les CDD d'usage: description: | From fc07701079ec03afcb96a68ae8b7733cebeeb09d Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Fri, 6 Mar 2020 14:32:49 +0100 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=90=9B=20D=C3=A9sactive=20le=20suivi?= =?UTF-8?q?=20des=20actions=20sur=20Safari=20mobile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uniquement pour les intégration iFrame. Relatif à #893. Revert de 6d185e et 65a905 --- index.html | 18 +++++++++++++++++- source/Tracker.ts | 20 ++++++++++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 78f84421b..612f2fc07 100644 --- a/index.html +++ b/index.html @@ -257,6 +257,22 @@ <% if (htmlWebpackPlugin.options.injectTrackingScript) { %> <% for (var chunk in htmlWebpackPlugin.files.chunks) { %> - + <% } %> diff --git a/source/Tracker.ts b/source/Tracker.ts index 830ee274b..3e80fc4a7 100644 --- a/source/Tracker.ts +++ b/source/Tracker.ts @@ -1,5 +1,5 @@ import { History, Location } from 'history' -import { debounce } from './utils' +import { debounce, inIframe } from './utils' declare global { interface Window { @@ -10,12 +10,28 @@ declare global { type PushArgs = ['trackPageView'] | ['trackEvent', ...Array] type PushType = (args: PushArgs) => void +const ua = window.navigator.userAgent +const iOSSafari = + (!!ua.match(/iPad/i) || !!ua.match(/iPhone/i)) && + !!ua.match(/WebKit/i) && + !ua.match(/CriOS/i) + export default class Tracker { push: PushType unlistenFromHistory: (() => void) | undefined previousPath: string | undefined - constructor(pushFunction: PushType = args => window._paq.push(args)) { + constructor( + pushFunction: PushType = args => { + // There is an issue with the way Safari handle cookies in iframe, cf. + // https://gist.github.com/iansltx/18caf551baaa60b79206. We could probably + // do better but for now we don't track action of iOs Safari user in + // iFrame -- to avoid errors in the number of visitors in our stats. + if (!(iOSSafari && inIframe)) { + window._paq.push(args) + } + } + ) { if (typeof window !== 'undefined') window._paq = window._paq || [] this.push = debounce(200, pushFunction) as PushType } From 7df6e5d318c173ac11e9efd3847d71d73d09ff4c Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Sun, 8 Mar 2020 19:43:21 +0100 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=90=9B=20D=C3=A9sactive=20les=20cooki?= =?UTF-8?q?es=20pour=20les=20iframes=20sur=20Safari=20Mobile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Relatif à #893. --- source/Tracker.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/source/Tracker.ts b/source/Tracker.ts index 3e80fc4a7..ce3bde045 100644 --- a/source/Tracker.ts +++ b/source/Tracker.ts @@ -7,7 +7,9 @@ declare global { } } -type PushArgs = ['trackPageView'] | ['trackEvent', ...Array] +type TrackingAction = 'trackPageView' | 'trackEvent' | 'disableCookies' + +type PushArgs = [TrackingAction, ...Array] type PushType = (args: PushArgs) => void const ua = window.navigator.userAgent @@ -22,18 +24,15 @@ export default class Tracker { previousPath: string | undefined constructor( - pushFunction: PushType = args => { - // There is an issue with the way Safari handle cookies in iframe, cf. - // https://gist.github.com/iansltx/18caf551baaa60b79206. We could probably - // do better but for now we don't track action of iOs Safari user in - // iFrame -- to avoid errors in the number of visitors in our stats. - if (!(iOSSafari && inIframe)) { - window._paq.push(args) - } - } + pushFunction: PushType = args => (window?._paq ?? []).push(args) ) { - if (typeof window !== 'undefined') window._paq = window._paq || [] this.push = debounce(200, pushFunction) as PushType + // There is an issue with the way Safari handle cookies in iframe, cf. + // https://gist.github.com/iansltx/18caf551baaa60b79206. + // TODO : We don't need to disable cookies if a cookie is already set + if (iOSSafari && inIframe) { + pushFunction(['disableCookies']) + } } connectToHistory(history: History) { From 233e9d34c329ab83904e38e5f743e523af45be8e Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Mon, 9 Mar 2020 09:39:17 +0100 Subject: [PATCH 4/4] =?UTF-8?q?D=C3=A9place=20trackPageView=20vers=20Track?= =?UTF-8?q?er.ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Car disableCookies doit être appelé avant trackPageView. --- index.html | 1 - source/Tracker.ts | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 612f2fc07..791294843 100644 --- a/index.html +++ b/index.html @@ -279,7 +279,6 @@ 'setDomains', ['*.mon-entreprise.fr', '*.mycompanyinfrance.fr'] ]) - _paq.push(['trackPageView']) _paq.push(['enableHeartBeatTimer', 30]) _paq.push(['enableLinkTracking']) ;(function() { diff --git a/source/Tracker.ts b/source/Tracker.ts index ce3bde045..22d590aed 100644 --- a/source/Tracker.ts +++ b/source/Tracker.ts @@ -33,6 +33,7 @@ export default class Tracker { if (iOSSafari && inIframe) { pushFunction(['disableCookies']) } + pushFunction(['trackPageView']) } connectToHistory(history: History) {