How to run code when cookie is added?
So I have the code below, and its purpose is to prevent the Facebook for Woocommerce plugin from running the FB pixel until the necessary consent is given. It works to solve the problem in the sense that when a new page is loaded, if the cookie consent is given, it will load the Pixel.
My problem though is that the code does NOT run when someone hits the "accept cookies" button without refreshing the page. So is there any way to make the code below run when consent is given (ie, when the cookie is first added, without requiring you to refresh the page)?