Is it possible to track a JavaScript Pop-up window to create an A/B test in Google Optimize?

I am trying to create an A/B test by switching off the pop-up windows on a page. These are created with JavaScript and create several versions of the same page. Therefore, there isn't a specific page I am able to target because of the JavaScript. On the Google Optimize I always end up with an “empty” page where I am not able to highlight the pop-ups to let Google Optimize know that I want to make a test with a page with pop-ups and another without. I do know that pop-ups are not a good choice, but I am trying to gather the data to prove my point to Management. Thank you for your help in advance. Cheers, Estela