How to listen for cookie value changes React?

Viewed 120

How to listen for cookie value changes ?

I am using a cookie consent tool ( CookieYes ) and I want to run a function that initializes Hotjar based on the cookie consent value that are setted by the consent manager. I was wondering is there a way of adding a listener to document.cookie ?

Furthermore, I googled a lot for this problem and the only solution I found was to use a timer for triggering the function, which I wanted to prevent.

0 Answers
Related