Skip to content

Usage with CookieConsent #10

@nitanmarcel

Description

@nitanmarcel

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
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions