-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: ajout de plausible * feat: logrocket
- Loading branch information
Showing
15 changed files
with
800 additions
and
692 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.", | ||
// }, | ||
}), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"use client"; | ||
import { useEffect } from "react"; | ||
import LogRocket from "logrocket"; | ||
import { useConsent } from "./ConsentManagement"; | ||
|
||
export function LogRocketInitializer() { | ||
const { finalityConsent } = useConsent(); | ||
|
||
useEffect(() => { | ||
finalityConsent?.analytics && | ||
process.env.NEXT_PUBLIC_LOGROCKET && | ||
LogRocket.init(process.env.NEXT_PUBLIC_LOGROCKET, { | ||
network: { | ||
requestSanitizer: (request) => { | ||
// Remove address request | ||
request.url = request.url.replace(/address=([^&]*)/, "address=***"); | ||
request.url = request.url.replace(/latitude=([^&]*)/, "latitude=***"); | ||
request.url = request.url.replace(/longitude=([^&]*)/, "longitude=***"); | ||
request.url = request.url.replace(/latitudeA=([^&]*)/, "latitudeA=***"); | ||
request.url = request.url.replace(/longitudeA=([^&]*)/, "longitudeA=***"); | ||
|
||
if (request.url.includes("api-adresse.data.gouv.fr")) { | ||
return null; | ||
} | ||
return request; | ||
}, | ||
}, | ||
browser: { | ||
urlSanitizer: (url) => { | ||
let sanitizedUrl = url; | ||
// Remove address | ||
sanitizedUrl = sanitizedUrl.replace(/address=([^&]*)/, "address=***"); | ||
sanitizedUrl = sanitizedUrl.replace(/latitude=([^&]*)/, "latitude=***"); | ||
sanitizedUrl = sanitizedUrl.replace(/longitude=([^&]*)/, "longitude=***"); | ||
sanitizedUrl = sanitizedUrl.replace(/latitudeA=([^&]*)/, "latitudeA=***"); | ||
sanitizedUrl = sanitizedUrl.replace(/longitudeA=([^&]*)/, "longitudeA=***"); | ||
return sanitizedUrl; | ||
}, | ||
}, | ||
}); | ||
}, [finalityConsent]); | ||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"use client"; | ||
import PlausibleProvider from "next-plausible"; | ||
import { useConsent } from "./ConsentManagement"; | ||
|
||
export function Plausible() { | ||
const { finalityConsent } = useConsent(); | ||
|
||
return ( | ||
finalityConsent?.analytics && ( | ||
<PlausibleProvider | ||
domain={process.env.NEXT_PUBLIC_DOMAIN || ""} | ||
trackOutboundLinks={true} | ||
taggedEvents={true} | ||
></PlausibleProvider> | ||
) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters