From 2b1278281be4ebe4a8569e587ee94be3e4eb267e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9rgio=20Rafael=20Siqueira?=
Date: Sat, 3 May 2025 20:57:47 -0300
Subject: [PATCH] fix
---
superpage/src/CookieConsentConfig.ts | 23 +++++++++++++++++--
superpage/src/layouts/Layout.astro | 13 ++++++-----
.../src/layouts/_components/Footer.astro | 1 +
3 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/superpage/src/CookieConsentConfig.ts b/superpage/src/CookieConsentConfig.ts
index 5eb04b4..7ad5d77 100644
--- a/superpage/src/CookieConsentConfig.ts
+++ b/superpage/src/CookieConsentConfig.ts
@@ -1,5 +1,12 @@
import type { CookieConsentConfig } from "vanilla-cookieconsent";
+declare global {
+ interface Window {
+ dataLayer: Record[];
+ gtag: (...args: any[]) => void;
+ }
+}
+
export const config: CookieConsentConfig = {
guiOptions: {
consentModal: {
@@ -26,6 +33,19 @@ export const config: CookieConsentConfig = {
ga4: {
label:
'Google Analytics 4',
+ 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: [
{
name: /^(_ga|_gid)/,
@@ -47,8 +67,7 @@ export const config: CookieConsentConfig = {
acceptAllBtn: "Aceitar todos",
acceptNecessaryBtn: "Rejeitar todos",
showPreferencesBtn: "Gerenciar preferências",
- // footer:
- // 'Privacy Policy\nTerms and conditions',
+ // footer: 'Política de Privacidade\nTermos e condições',
},
preferencesModal: {
title: "Centro de Preferências de Consentimento",
diff --git a/superpage/src/layouts/Layout.astro b/superpage/src/layouts/Layout.astro
index c8f6b64..ef07109 100644
--- a/superpage/src/layouts/Layout.astro
+++ b/superpage/src/layouts/Layout.astro
@@ -20,12 +20,11 @@ import Footer from "./_components/Footer.astro";
-
+
+
diff --git a/superpage/src/layouts/_components/Footer.astro b/superpage/src/layouts/_components/Footer.astro
index 63c676d..e29ce9a 100644
--- a/superpage/src/layouts/_components/Footer.astro
+++ b/superpage/src/layouts/_components/Footer.astro
@@ -13,6 +13,7 @@ const year = new Date().getFullYear();
© {year} EDUSEG® Todos os direitos reservados. CNPJ15.608.435/0001-90
—
+