Title: How to read cookie variable
Last modified: June 21, 2018

---

# How to read cookie variable

 *  Resolved [clemens3636](https://wordpress.org/support/users/clemens3636/)
 * (@clemens3636)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/how-to-read-cookie-variable/)
 * The documentation states: “By default the cookie value will be set to ‘null’.
   If the user clicks ‘Accept’ button the value with be changed to ‘yes’. IF the
   user clicks on ‘Reject’ the value will be set to ‘no’. Your developer can check
   this value to set a cookie.”
 * Does this mean that I can run code like:
    if (cookie == ‘no’) {window[‘ga-disable-
   UA-111797327-1’] = true};
 * Please correct the variable name if needed, and the code, since I do not know
   this language.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fhow-to-read-cookie-variable%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Mark](https://wordpress.org/support/users/markwt/)
 * (@markwt)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/how-to-read-cookie-variable/#post-10438815)
 * Hi [@clemens3636](https://wordpress.org/support/users/clemens3636/),
 * The name of the cookie set by the plugin is viewed_cookie_policy. You need to
   change the name of the variable “cookie” to “viewed_cookie_policy”.
 *  Thread Starter [clemens3636](https://wordpress.org/support/users/clemens3636/)
 * (@clemens3636)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/how-to-read-cookie-variable/#post-10461116)
 * Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to read cookie variable’ is closed to new replies.

 * ![](https://ps.w.org/cookie-law-info/assets/icon.svg?rev=3007243)
 * [CookieYes – Cookie Banner for Cookie Consent (Easy to setup GDPR/CCPA Compliant Cookie Notice)](https://wordpress.org/plugins/cookie-law-info/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cookie-law-info/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cookie-law-info/)
 * [Active Topics](https://wordpress.org/support/plugin/cookie-law-info/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cookie-law-info/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cookie-law-info/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [clemens3636](https://wordpress.org/support/users/clemens3636/)
 * Last activity: [7 years, 10 months ago](https://wordpress.org/support/topic/how-to-read-cookie-variable/#post-10461116)
 * Status: resolved