Jump to content

Jay9170

Member
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Jay9170

  1. Not sure if something to this effect can be injected into the header of page. Would need to update specific terms to function within squarespace depending on language they use for subscribed, emailForm etc. <script> // Function to set the subscription status in localStorage function setSubscriptionStatus() { window.localStorage.setItem('subscribed', '1'); } // Check if the user has already subscribed function hasSubscribed() { return window.localStorage.getItem('subscribed') === '1'; } document.addEventListener('DOMContentLoaded', function() { var promotionPopUp = document.querySelector('.squarespace-popup-overlay'); // Check if the pop-up should be shown and if the user hasn't subscribed yet if (!hasSubscribed()) { promotionPopUp.style.display = 'block'; } // Find the email form inside the pop-up var emailForm = promotionPopUp.querySelector('form'); // Add event listener to the form submission emailForm.addEventListener('submit', function(event) { event.preventDefault(); // Prevent the form from submitting normally // Your additional logic to handle form submission (e.g., sending the email address to your email list) // Set the subscription status in localStorage after successful submission setSubscriptionStatus(); // Hide the pop-up after subscription promotionPopUp.style.display = 'none'; }); }); </script>
  2. Did you ever find a solution for this? I currently have the pop-up, but it disappears if someone leaves the page and comes back or refreshes the page. I've injected this code into the header of the page to solve that, however this causes the pop-up to keep coming up even if the person enters their email. <script> window.localStorage.setItem('test', '0'); window.localStorage.setItem('squarespace-popup-overlay', '0'); </script> I also have the following settings, but the next day feature will not help if the person leaves the page and comes back or refreshes the page that same day.
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.