Specify Popups amount of impressions

Hi, I have a suggestion.
Sometimes I need a specific amount of impressions for a Popup to be shown. And sometimes I need a specific amount of clicks on Popup. So idea is that when a certain amount of impressions is shown or clicks made, the Popup stop showing. In other words campaign is over.