From 947cffbff4e5d19f7ae582ca2fa624eaf0d956d5 Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Sat, 31 Oct 2020 20:37:45 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Correction=20du=20tracking=20Mat?= =?UTF-8?q?omo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les urls remontées n'étaient pas mises à jour lors de la navigation --- mon-entreprise/source/Tracker.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mon-entreprise/source/Tracker.ts b/mon-entreprise/source/Tracker.ts index 953a0f16b..68a942eff 100644 --- a/mon-entreprise/source/Tracker.ts +++ b/mon-entreprise/source/Tracker.ts @@ -7,7 +7,12 @@ declare global { } } -type PushArgs = ['trackPageView'] | ['trackEvent', ...Array] +type MatomoAction = + | 'trackPageView' + | 'trackEvent' + | 'setReferrerUrl' + | 'setCustomUrl' +type PushArgs = [MatomoAction, ...Array] type PushType = (args: PushArgs) => void const ua = window.navigator.userAgent @@ -60,6 +65,12 @@ export default class Tracker { if (this.previousPath === currentPath) { return } + if (this.previousPath) { + this.push(['setReferrerUrl', this.previousPath]) + } + this.push(['setCustomUrl', currentPath]) + // TODO: We should also call 'setDocumentTitle' but at this point the + // document.title isn't updated yet. this.push(['trackPageView']) this.previousPath = currentPath }