Create Cookie On the Click of an Element Within Your Popup
Let's say you have an Auto Open Popup that triggers as soon as users visit your site - no matter what page the user hits your site on, you want the popup to open - thus, it's a sitewide popup. Inside the popup is two images: clicking either one of the images puts you down Path A or Path B.
Once the user selects their path, you don't want them to continuously be spammed by your popup, so you have to set the Cookie on the click of the image element - this method works with any HTML element (text, image, link, etc.).
Setup Your Cookie
After clicking Add, you will be able to customize every aspect of how your Cookie will behave. For detailed explanations on all of the Cookie Settings and features, check out the Cookie Settings and Features Doc.
Copy, paste and edit the following code either in your parent or child theme functions.php file, or use the 'My Custom Functions' plugin.
The placeholder parameter 'css-selector-for-the-close-button' should be replaced with the HTML ID or class attribute assigned to the target page element. See the following related article for guidance on finding CSS selectors on your site.
Related article: Getting CSS Selectors
Replace the popup ID number in the code example with the value assigned to your popup. The ID is located in the WordPress admin at 'Popup Maker' >> 'All Popups' >> 'CSS Classes' (column). The integer value is appended to the class name 'popmake-'.