📈 ajoute le tracking de la satisfaction

pull/1422/head
Johan Girod 2021-02-18 11:13:55 +01:00
parent cbaa3246ec
commit e14b0c0334
8 changed files with 3703 additions and 157 deletions

View File

@ -0,0 +1,2 @@
ignorePatterns:
- smarttag.js

View File

@ -1,8 +1,5 @@
import './smarttag.js'
type CustomPageObject = {}
type CustomHitObject = {}
// Ci-dessous les indicateurs personnalisés de site et de page
// https://developers.atinternet-solutions.com/javascript-fr/contenus-javascript-fr/indicateurs-de-site-et-de-page-javascript-fr/
export const INDICATOR = {
@ -17,7 +14,7 @@ type CustomSiteIndicator = {
[INDICATOR.SITE.LANGAGE]: '[fr]' | '[en]' // langage du site (mycompanyinfrance ou mon-entreprise)
[INDICATOR.SITE.EMBARQUÉ]: 1 | 0 // intégration externe
}
type CustomPageIndicator = {}
type CustomPageIndicator = Record<string, string>
type ATHit = {
name?: string

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@ import { TrackerContext } from 'Components/utils/withTracker'
import React, { useCallback, useContext, useState } from 'react'
import { Trans } from 'react-i18next'
import { useLocation } from 'react-router-dom'
import { TrackingContext } from '../../ATInternetTracking'
import safeLocalStorage from '../../storage/safeLocalStorage'
import './Feedback.css'
import Form from './FeedbackForm'
@ -42,6 +43,7 @@ export default function PageFeedback({
location.pathname,
]),
})
const ATTracker = useContext(TrackingContext)
const handleFeedback = useCallback(({ useful }: { useful: boolean }) => {
tracker.push([
@ -50,6 +52,10 @@ export default function PageFeedback({
useful ? 'positive rating' : 'negative rating',
location.pathname,
])
ATTracker.click.send({
chapter1: 'satisfaction',
name: useful ? 'positive' : 'negative',
})
const feedback = [
customEventName || 'rate page usefulness',
location.pathname,

View File

@ -31,7 +31,7 @@ export default function PercentageField({
debouncedOnChange(value)
}}
type="range"
value={localValue as number}
value={localValue}
name="volume"
min="0"
step="0.05"

View File

@ -1,5 +1,4 @@
import { setSimulationConfig } from 'Actions/actions'
import { useEffect } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { useHistory } from 'react-router'
import { Company } from 'Reducers/inFranceAppReducer'
@ -25,11 +24,9 @@ export default function useSimulationConfig(
: undefined
const lastConfig = useSelector(configSelector)
useEffect(() => {
if (config && lastConfig !== config) {
dispatch(setSimulationConfig(config ?? {}, url, initialSituation))
}
}, [config, initialSituation])
if (config && lastConfig !== config) {
dispatch(setSimulationConfig(config ?? {}, url, initialSituation))
}
}
export function getCompanySituation(company: Company | null): Situation {

View File

@ -776,12 +776,8 @@ export function getSimulatorsData({
},
pamc: {
private: true,
tracking: {
chapter2: 'profession_liberale',
chapter3: 'pamc',
name: 'accueil',
},
iframe: 'pamc',
tracking: {},
title: t(
'pages.simulateurs.pamc.title',
@ -805,6 +801,7 @@ export function getSimulatorsData({
},
'aides-embauche': {
icône: '🎁',
tracking: 'aides_embauche',
meta: {
title: 'Aides à lembauche',
description:
@ -848,9 +845,8 @@ export function getSimulatorsData({
},
is: {
icône: '🗓',
tracking: {
name: 'impot-societe',
},
tracking: 'impot-societe',
path: sitePaths.simulateurs.is,
iframe: 'impot-societe',
meta: {

View File

@ -13,7 +13,7 @@ const localStorageKey = (pathname: string) =>
export function setupSimulationPersistence(
store: Store<RootState, Action>,
debounceDelay: number = 1000
debounceDelay = 1000
) {
const listener = () => {
const state = store.getState()