To provide correct work of this code under WebWarper, it is necessary to use the call "___ww_setDomain(...)" - in case, when the page is viewed via WebWarper ("if (window.___ww) {..."). In this case it is also necessary to keep in mind, that the address of the page starts with prefix — call of WebWarper script, so it may be necessary to review old support logic for some subdomains.