Title: Set Window Variable While Click On Cookie Accept Button
Last modified: December 6, 2018

---

# Set Window Variable While Click On Cookie Accept Button

 *  [chintan009](https://wordpress.org/support/users/chintan009/)
 * (@chintan009)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/set-window-variable-while-click-on-cookie-accept-button/)
 * Hi,
 * I want to set Window level variable while user click on Accept button.
 * For example code – Window.varABC = [1];
 * Where can i add this code?
 * I already analysed and checked “Script blocking” functionality. It’s not do anything
   while user Click on accept button. Its just run script code, after reload the
   page.
 * I already checked “cookie-notice/js/front.js” file. That handles the Accept button
   click event. As below, I try to put my above code in file but it didn’t work.
 * // handle set-cookie button click
    $( document ).on( ‘click’, ‘.cn-set-cookie’,
   function ( e ) { e.preventDefault();
 *  Window.varABC = [1]; // my code
 *  $( this ).setCookieNotice( $( this ).data( ‘cookie-set’ ) );
    } );
 * Please can you guide me for above query.
 * Regards,

The topic ‘Set Window Variable While Click On Cookie Accept Button’ is closed to
new replies.

 * ![](https://ps.w.org/cookie-notice/assets/icon-256x256.png?rev=3549327)
 * [Compliance by Hu-manity.co](https://wordpress.org/plugins/cookie-notice/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cookie-notice/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cookie-notice/)
 * [Active Topics](https://wordpress.org/support/plugin/cookie-notice/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cookie-notice/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cookie-notice/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [chintan009](https://wordpress.org/support/users/chintan009/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/set-window-variable-while-click-on-cookie-accept-button/)
 * Status: not resolved