Skip to content

Commit

Permalink
Ajusta estilos do banner de consentimento de cookies e remove logs do…
Browse files Browse the repository at this point in the history
… Google Analytics
  • Loading branch information
RoodneyMoraes committed Nov 17, 2024
1 parent be6b37d commit e313334
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/css/custom-index.css
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ footer .social-icons a {

.cookie-consent-banner div {
width: 100%;
margin-bottom: 12px;
}

.cookie-consent-banner .d-flex {
Expand All @@ -199,6 +200,7 @@ footer .social-icons a {

.cookie-consent-banner .btn {
width: 100%;
margin-top: 10px;
margin-bottom: 10px;
}

Expand Down
1 change: 1 addition & 0 deletions src/css/custom-page.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ footer {

.cookie-consent-banner div {
width: 100%;
margin-bottom: 12px;
}

.cookie-consent-banner .d-flex {
Expand Down
8 changes: 0 additions & 8 deletions src/js/google-analytics.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
document.addEventListener('DOMContentLoaded', () => {
const consentAccepted = localStorage.getItem('consentAccepted');
console.log('Consent accepted:', consentAccepted);

if (!consentAccepted) {
console.log('Displaying cookie consent banner');
document.getElementById('cookieConsentBanner').style.display = 'block';
}

document.getElementById('acceptConsent').addEventListener('click', () => {
console.log('Accept button clicked');
localStorage.setItem('consentAccepted', 'true');
loadGoogleAnalytics();
document.getElementById('cookieConsentBanner').style.display = 'none';
document.getElementById('cookieConsentBanner').setAttribute('style', 'display: none !important');
console.log('Banner hidden after accept');
});

document.getElementById('declineConsent').addEventListener('click', () => {
console.log('Decline button clicked');
document.getElementById('cookieConsentBanner').style.display = 'none';
document.getElementById('cookieConsentBanner').setAttribute('style', 'display: none !important');
console.log('Banner hidden after decline');
});

function loadGoogleAnalytics() {
console.log('Loading Google Analytics');
const script = document.createElement('script');
script.src = 'https://www.googletagmanager.com/gtag/js?id=G-CMLZKJVKKY';
script.async = true;
Expand All @@ -35,7 +28,6 @@ document.addEventListener('DOMContentLoaded', () => {
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-CMLZKJVKKY');
console.log('Google Analytics loaded');
};
}

Expand Down

0 comments on commit e313334

Please sign in to comment.