Skip to content

Commit

Permalink
feat(tools): track tools usage (#2381)
Browse files Browse the repository at this point in the history
* feat(tools): track tools usage

fix #2368

* fix(tracking): use array
  • Loading branch information
lionelB authored Feb 19, 2020
1 parent 07cf388 commit 0a2fa42
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/code-du-travail-frontend/pages/outils/[slug].js
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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,
Expand All @@ -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 (
<Layout>
<Metas
Expand Down

0 comments on commit 0a2fa42

Please sign in to comment.