Created
April 28, 2026 08:37
-
-
Save webtoffee-git/640b4476a4b63cc954be95101b3a3a52 to your computer and use it in GitHub Desktop.
check whether the user has already consented in a previous session and act accordingly - By WebToffee
This file contains hidden or 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
| document.addEventListener("_wccBannerVisible", function (event) { | |
| const consentData = getWccConsent(); | |
| // Check stored analytics consent | |
| if (consentData.categories.analytics === true) { | |
| console.log("Analytics consent is YES (true)."); | |
| // Load analytics scripts | |
| } else { | |
| console.log("Analytics consent is NO (false)."); | |
| // Do not load analytics scripts | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment