Skip to content
Snippets Groups Projects
Commit c8325c73 authored by Toufic Batache's avatar Toufic Batache
Browse files

Ajout des stats matomo pour tracker le bouton accordéon des graphiques cas types

parent 2d023c0d
No related branches found
No related tags found
1 merge request!207Ajout des stats matomo pour tracker le bouton accordéon des graphiques cas types
Pipeline #13070 passed
......@@ -34,6 +34,7 @@
import type { DisplayMode } from "$lib/displays"
import { entityByKey, personEntityKey } from "$lib/entities"
import type { VariableCustomization, VariableGraph } from "$lib/graphes"
import { trackTestCaseGraph } from "$lib/matomo"
import {
type CalculationByName,
getSituationVariableValue,
......@@ -1112,9 +1113,14 @@
{#if firstPersonActivity !== "inactif"}
<button
class="w-full flex items-center gap-2 text-neutral-600 text-start border-b px-4 py-2 mt-10 hover:bg-neutral-100 active:bg-neutral-200 transition-all"
on:click={situation.slider === undefined
? requestAxesCalculation
: removeSituationSlider}
on:click={() => {
if (situation.slider === undefined) {
requestAxesCalculation()
trackTestCaseGraph(firstPersonActivity)
} else {
removeSituationSlider()
}
}}
>
<iconify-icon class="text-lg" icon="ri-line-chart-fill" />
<span class="flex-1 font-bold">
......
import { browser } from "$app/environment"
import type { ParametricReform } from "$lib/reforms"
import type { VariableValue } from "$lib/variables"
function trackEvent(category: string, action: string, name: string) {
if (browser) {
......@@ -206,3 +207,19 @@ export function trackTestCaseShowAllVariables() {
export function trackTestCaseShare() {
trackEvent("test_case", "share", "Partage d'une simulation cas type")
}
export function trackTestCaseGraph(activity: VariableValue | undefined) {
let variable = "revenu"
switch (activity) {
case "actif":
variable = "salaire"
break
case "retraite":
variable = "retraite"
break
case "chomeur":
variable = "chômage"
break
}
trackEvent("test_case", "show_graph", `Ouverture du graphique "${variable}"`)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment