diff --git a/ui/app/components/ConsentManagement.tsx b/ui/app/components/ConsentManagement.tsx
new file mode 100644
index 0000000..802dd8b
--- /dev/null
+++ b/ui/app/components/ConsentManagement.tsx
@@ -0,0 +1,21 @@
+"use client";
+
+import { createConsentManagement } from "@codegouvfr/react-dsfr/consentManagement";
+
+export const {
+ ConsentBannerAndConsentManagement,
+ FooterConsentManagementItem,
+ FooterPersonalDataPolicyItem,
+ useConsent,
+} = createConsentManagement({
+ finalityDescription: ({ lang }) => ({
+ analytics: {
+ title: "Analyse",
+ description: "Nous utilisons des cookies pour mesurer l’audience de notre site et améliorer son contenu.",
+ },
+ personalization: {
+ title: "Personnalisation",
+ description: "Nous utilisons des cookies pour vous proposer des contenus adaptés à vos centres d’intérêts.",
+ },
+ }),
+});
diff --git a/ui/app/components/LogRocketInitializer.tsx b/ui/app/components/LogRocketInitializer.tsx
index 0af87a7..5ce1932 100644
--- a/ui/app/components/LogRocketInitializer.tsx
+++ b/ui/app/components/LogRocketInitializer.tsx
@@ -1,10 +1,14 @@
"use client";
import { useEffect } from "react";
import LogRocket from "logrocket";
+import { useConsent } from "./ConsentManagement";
export function LogRocketInitializer() {
+ const { finalityConsent } = useConsent();
+
useEffect(() => {
- process.env.NEXT_PUBLIC_LOGROCKET &&
+ finalityConsent?.analytics &&
+ process.env.NEXT_PUBLIC_LOGROCKET &&
LogRocket.init(process.env.NEXT_PUBLIC_LOGROCKET, {
network: {
requestSanitizer: (request) => {
@@ -34,6 +38,6 @@ export function LogRocketInitializer() {
},
},
});
- });
+ }, [finalityConsent]);
return null;
}
diff --git a/ui/app/components/Plausible.tsx b/ui/app/components/Plausible.tsx
new file mode 100644
index 0000000..6f75f19
--- /dev/null
+++ b/ui/app/components/Plausible.tsx
@@ -0,0 +1,17 @@
+"use client";
+import PlausibleProvider from "next-plausible";
+import { useConsent } from "./ConsentManagement";
+
+export function Plausible() {
+ const { finalityConsent } = useConsent();
+
+ return (
+ finalityConsent?.analytics && (
+