This commit is contained in:
2025-05-03 20:57:47 -03:00
parent 03e552089a
commit 2b1278281b
3 changed files with 29 additions and 8 deletions

View File

@@ -1,5 +1,12 @@
import type { CookieConsentConfig } from "vanilla-cookieconsent"; import type { CookieConsentConfig } from "vanilla-cookieconsent";
declare global {
interface Window {
dataLayer: Record<string, any>[];
gtag: (...args: any[]) => void;
}
}
export const config: CookieConsentConfig = { export const config: CookieConsentConfig = {
guiOptions: { guiOptions: {
consentModal: { consentModal: {
@@ -26,6 +33,19 @@ export const config: CookieConsentConfig = {
ga4: { ga4: {
label: label:
'<a href="https://marketingplatform.google.com/about/analytics/terms/br/" target="_blank">Google Analytics 4</a>', '<a href="https://marketingplatform.google.com/about/analytics/terms/br/" target="_blank">Google Analytics 4</a>',
onAccept: () => {
console.log("ga4 accepted");
window.gtag("consent", "update", {
ad_storage: "granted",
ad_user_data: "granted",
ad_personalization: "granted",
analytics_storage: "granted",
});
},
onReject: () => {
console.log("ga4 rejected");
},
cookies: [ cookies: [
{ {
name: /^(_ga|_gid)/, name: /^(_ga|_gid)/,
@@ -47,8 +67,7 @@ export const config: CookieConsentConfig = {
acceptAllBtn: "Aceitar todos", acceptAllBtn: "Aceitar todos",
acceptNecessaryBtn: "Rejeitar todos", acceptNecessaryBtn: "Rejeitar todos",
showPreferencesBtn: "Gerenciar preferências", showPreferencesBtn: "Gerenciar preferências",
// footer: // footer: '<a href="#link">Política de Privacidade</a>\n<a href="#link">Termos e condições</a>',
// '<a href="#link">Privacy Policy</a>\n<a href="#link">Terms and conditions</a>',
}, },
preferencesModal: { preferencesModal: {
title: "Centro de Preferências de Consentimento", title: "Centro de Preferências de Consentimento",

View File

@@ -20,12 +20,11 @@ import Footer from "./_components/Footer.astro";
<script <script
is:inline is:inline
data-category="analytics"
type="text/partytown" type="text/partytown"
src="https://www.googletagmanager.com/gtag/js?id=G-G2989LF493" src="https://www.googletagmanager.com/gtag/js?id=G-G2989LF493"
></script> ></script>
<script is:inline data-category="analytics" type="text/partytown"> <script is:inline type="text/partytown">
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag() { function gtag() {
dataLayer.push(arguments); dataLayer.push(arguments);
@@ -33,14 +32,16 @@ import Footer from "./_components/Footer.astro";
gtag("js", new Date()); gtag("js", new Date());
gtag("consent", "default", { gtag("consent", "default", {
ad_storage: "granted", ad_storage: "denied",
ad_user_data: "granted", ad_user_data: "denied",
ad_personalization: "granted", ad_personalization: "denied",
analytics_storage: "granted", analytics_storage: "denied",
}); });
gtag("config", "G-G2989LF493"); gtag("config", "G-G2989LF493");
</script> </script>
<script is:inline data-category="analytics"></script>
</head> </head>
<body> <body>

View File

@@ -13,6 +13,7 @@ const year = new Date().getFullYear();
&copy; {year} EDUSEG&reg; Todos os direitos reservados. CNPJ15.608.435/0001-90 &copy; {year} EDUSEG&reg; Todos os direitos reservados. CNPJ15.608.435/0001-90
</p> </p>
<span>&mdash;</span> <span>&mdash;</span>
<CookieConsent /> <CookieConsent />
</div> </div>