Skip to content

Commit

Permalink
feat(iframeFormation): add missing tracking event
Browse files Browse the repository at this point in the history
  • Loading branch information
yohanngab committed Dec 16, 2024
1 parent e3b852f commit 2c6c846
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 12 additions & 1 deletion ui/src/iframes/Components/TrouverUneEntrepriseRating.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import school from "../../assets/images/school-small.svg";
import search from "../../assets/images/search.svg";
import selfTraining from "../../assets/images/self-training.svg";
import useBreakpoints from "../../hooks/useBreakpoints";
import useMatomoEvent from "../../hooks/useMatomoEvent";
import { MATOMO_ACTION, MATOMO_CATEGORY } from "../../matomo";
import {
CardsContainer,
DidYouKnowContainer,
Expand Down Expand Up @@ -53,6 +55,7 @@ const TrouverEntrepriseCard = ({ percentage, count, label, position, seeMore })

const TrouverUneEntrepriseRating = ({ data, etablissementsCount }) => {
const [seeMore, setSeeMore] = useState(false);
const trackEvent = useMatomoEvent();

return (
<TrouverUneEntrepriseRatingContainer>
Expand Down Expand Up @@ -81,7 +84,15 @@ const TrouverUneEntrepriseRating = ({ data, etablissementsCount }) => {
<TrouverEntrepriseCard key={item.label} {...item} position={index + 1} seeMore={seeMore} />
))}
</CardsContainer>
<p onClick={() => setSeeMore((prevValue) => !prevValue)}>
<p
onClick={() => {
trackEvent(
MATOMO_CATEGORY.IFRAME_FORMATION,
seeMore ? MATOMO_ACTION.CLICK_TROUVER_ENTREPRISE_SEE_LESS : MATOMO_ACTION.CLICK_TROUVER_ENTREPRISE_SEE_MORE
);
setSeeMore((prevValue) => !prevValue);
}}
>
{seeMore ? "Voir moins" : "Voir plus"}{" "}
<span className={fr.cx(seeMore ? "fr-icon-arrow-up-s-line" : "fr-icon-arrow-down-s-line")} />
</p>
Expand Down
4 changes: 3 additions & 1 deletion ui/src/matomo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const MATOMO_ACTION = {
CLICK_CAROUSEL_PREVIOUS: "Click carousel précédent",
CLICK_CAROUSEL_NEXT: "Click carousel suivant",
CLICK_CAROUSEL_SEE_MORE: "Click carousel voir plus de témoignages",
CLICK_THEMATIC_FROM_GRAPH: "Click thématique depuis graphique", //todo
CLICK_THEMATIC_FROM_GRAPH: "Click thématique depuis graphique",
CLICK_GRAPHIC_VIEW: "Click passage en mode graphique",
CLICK_TABLE_VIEW: "Click passage en mode tableau",
CLICK_VERBATIM_SEE_MORE: "Click voir plus",
Expand All @@ -16,4 +16,6 @@ export const MATOMO_ACTION = {
CLICK_QUESTION: "Click question",
CLICK_GO_BACK_THEMATICS: "Click revenir en arrière thématiques",
CLICK_GO_BACK_QUESTIONS: "Click revenir en arrière questions",
CLICK_TROUVER_ENTREPRISE_SEE_MORE: "Click voir plus trouver une entreprise",
CLICK_TROUVER_ENTREPRISE_SEE_LESS: "Click voir moins trouver une entreprise",
};

0 comments on commit 2c6c846

Please sign in to comment.