How to add a Substack Newsletter Sign-up form to a Squarespace Promotional Pop-up

Squarespace has a built-in promotional pop-up feature that is great for getting new newsletter subscribers, but it only works with the native square space mailing list, MailChimp, or Google Drive. After a whole bunch of experimenting and hair pulling, here is a fix that I developed that allows you to change the content of the square space pop-up and make it, insert your SubStack newsletter sign-up form instead. Right now this is working for me using Squarespace 7.1.

  1. Copy your substack iFrame embed code.
  2. Go here and paste it in to have a reformatted to escape out all spaces and annoying characters that can mess with the JavaScript.
  3. Copy the code below, and paste your escaped embed code where it says iFrameContent
  4. Go to Settings > Advanced > Code Injection on your Squarespace site.
  5. Paste the script into the footer so that it is executed on every page where the pop-up may appear.

Enjoy!