From 0a2fa426e96e82f5c32014393e5ce373822eaa4c Mon Sep 17 00:00:00 2001 From: Lionel Date: Wed, 19 Feb 2020 18:28:54 +0100 Subject: [PATCH] feat(tools): track tools usage (#2381) * feat(tools): track tools usage fix #2368 * fix(tracking): use array --- packages/code-du-travail-frontend/pages/outils/[slug].js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/code-du-travail-frontend/pages/outils/[slug].js b/packages/code-du-travail-frontend/pages/outils/[slug].js index 92c3f10527..b1af6b6752 100644 --- a/packages/code-du-travail-frontend/pages/outils/[slug].js +++ b/packages/code-du-travail-frontend/pages/outils/[slug].js @@ -1,8 +1,9 @@ -import React from "react"; +import React, { useEffect } from "react"; import tools from "@cdt/data...tools"; import { Badge, Container, Section, Wrapper } from "@socialgouv/react-ui"; import { Layout } from "../../src/layout/Layout"; +import { matopush } from "../../src/piwik"; import Metas from "../../src/common/Metas"; import { CalculateurIndemnite } from "../../src/outils/IndemniteLicenciement"; @@ -11,6 +12,7 @@ import { SimulateurEmbauche } from "../../src/outils/SimulateurEmbauche"; import { SimulateurIndemnitePrecarite } from "../../src/outils/IndemnitePrecarite"; import { DureePreavisDemission } from "../../src/outils/DureePreavisDemission"; import { HeuresRechercheEmploi } from "../../src/outils/HeuresRechercheEmploi"; + const toolsBySlug = { "indemnite-licenciement": CalculateurIndemnite, "preavis-licenciement": DureePreavisLicenciement, @@ -22,6 +24,9 @@ const toolsBySlug = { function Outils({ description, icon, ogImage, pageUrl, slug, title }) { const Tool = toolsBySlug[slug]; + useEffect(() => { + matopush(["trackEvent", `outil_${title}`, "start"]); + }); return (