As seen in the link above, this will require some custom coding on your end and will make use of HubSpot's pop up forms feature.
One thing to note here is that this is only possible with a button, not with a HubSpot CTA as a HubSpot CTA requires a specific URL to redirect those who click on it!