dake Posted August 13, 2020 Share Posted August 13, 2020 Hello all, maybe someone can help me with this: Is it possible with 7.1 that the promotion pop up only disappears when the user has subscribed via email. Something like a lock page. That the user only gets access to a page if he has subscribed via email. Thanks for you help. Best, Dake Link to comment
Jay9170 Posted July 26, 2023 Share Posted July 26, 2023 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. Link to comment
Jay9170 Posted July 26, 2023 Share Posted July 26, 2023 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> Link to comment
Jay9170 Posted August 7, 2023 Share Posted August 7, 2023 Bumping this up. Anyone have an idea on how to do this? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment