-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31bda11
commit 1dc8ca1
Showing
2 changed files
with
41 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,32 @@ | ||
<div id="cookieconsent" class="cookie-banner" style="display: none"> | ||
<p>By using our website, you agree to our <a href="/docs/mmex/cookiepolicy">cookie policy</a>. We use cookies to give you the best online experience.</a></p> | ||
<button id="cookieclose" class="btn btn-primary">Got it!</button> | ||
</div> | ||
<div id="cookieconsent" class="cookie-banner" style="display: none;"> | ||
<p>By using our website, you agree to our <a href="/docs/mmex/cookiepolicy">cookie policy</a>. We use cookies to give you the best online experience.</p> | ||
<button id="cookieclose" class="btn btn-primary">Got it!</button> | ||
</div> | ||
|
||
<script> | ||
window.onload = function() { | ||
var consentBanner = document.getElementById('cookieconsent'); | ||
var consentButton = document.getElementById('cookieclose'); | ||
|
||
// Check if consent has been already given | ||
if (localStorage.getItem('cookieConsent') === 'true') { | ||
consentBanner.style.display = 'none'; // Hide consent banner | ||
gtag('consent', 'update', { | ||
'ad_storage': 'granted', | ||
'analytics_storage': 'granted' | ||
}); | ||
} else { | ||
consentBanner.style.display = 'block'; // Show banner if no consent | ||
} | ||
|
||
// When the user clicks 'Got it!', store consent and hide the banner | ||
consentButton.addEventListener('click', function() { | ||
localStorage.setItem('cookieConsent', 'true'); // Store consent in localStorage | ||
consentBanner.style.display = 'none'; // Hide banner | ||
gtag('consent', 'update', { | ||
'ad_storage': 'granted', | ||
'analytics_storage': 'granted' | ||
}); | ||
}); | ||
}; | ||
</script> |
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