How to handle pop-ups in a website using designer?

The user will not be knowing when exactly the window might be popped up and has to handle the popup with an if condition so that, if a particular message or a link or an image is present in the popup and the user recognizes that particular element and has to take necessary decisions. Here is an example for the mentioned situation and its implementation in Appvance Designer.

Consider user navigates to www.appvance.com. The user might get a pop up sometimes and sometimes not. Hence we have used an If condition with the Appvance Designer API (_isVisible_Heading("Sign up for email updates")) which returns the Boolean value based on the presence of the heading "Sign up for email updates". If the condition is true, then the further actions are performed on the popup and if the condition is false, the span of If condition is skipped for further continuation of the script.

Here is the script attached for the above mentioned example

Popup.ds