Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage with CookieConsent #10

Open
nitanmarcel opened this issue Nov 21, 2024 · 1 comment
Open

Usage with CookieConsent #10

nitanmarcel opened this issue Nov 21, 2024 · 1 comment
Labels
question Further information is requested

Comments

@nitanmarcel
Copy link

How can I use this with CookieConsent?

The cookies are sent as soon as the page loads and the consent popup is up.

I've tried doing this to set cookie_consent to false when the page loads:


  <script>
      document.cookie = "cookie_consent=false; path=/; max-age=31536000";
  </script>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orestbida/[email protected]/dist/cookieconsent.css">

then set it to true once the consent is granted:

  <script
      type="text/plain"
      data-category="analytics">
      document.cookie = "cookie_consent=true; path=/; max-age=31536000";
  </script>

But the analytics are send no matter if cookie_consent is true or false, or even if it exists:

  umami {
  	event_endpoint "https://example.com/api/send"
  	website_uuid "1234"
  	allowed_extensions "" .html .htm
  	trusted_ip_header X-Forwarded-For
  	cookie_consent cookie_consent
  	cookie_resolution
  	device_detection
  }
@jonaharagon
Copy link
Owner

Can you try this again with the latest commit 7dc7b29?

This release also changes the behavior to only send analytics when the cookie is set to true (as opposed to disabling analytics when the cookie is set to false, as it was previously), which is more in line with privacy expectations and avoids the need to set cookie_consent=false when the page is initially loaded entirely.

@jonaharagon jonaharagon added the question Further information is requested label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants