Streaming live at 10am (PST)

Only ask for e-mail the first time someone visits the page?


#1

Hey everyone! First post here.

Also building my first website on Webflow for my tea company. Been loving the process so far!

I am trying to build something where there is a ‘landing page’ that asks for the visitor’s email for access to our ecommerce store, as well as our other local services. But I obviously don’t want to pesker people, asking for their emails everytime they visit the site, even though they already gave us their emails before. I also don’t want to get a bunch of duplicate email submissions all the time.

My question is if the form block automatically reads the visitor’s cookies? If not, is there any way I could build something where the site checks if that computer already submitted email before? and only shows the landing page if it hasnt?

Thanks for all the help in advance!


#2

Hi @itsweichao. I’m one of the engineers here at Webflow. To answer your immediate question; no, forms are not tied in any way to cookies.

Your intuition is right on however and cookies is one way to get you close to what you want to do! You’ll need some custom code however.

In general, you’d want to attach an event listener to the form submission and when it succeeds, set a cookie. Then, again using custom code, you’d need to check for the presence of this cookie when your site loads and conditionally hide the email form. Additionally, you could check for the presence of this cookie and redirect the user to the landing page if it’s not there or redirect them to whatever non-landing page you want them to go to if they’ve already submitted their email.

This isn’t a “perfect” solution however because many things can happen that removes this cookie. The passing of time, using a new computer, using a different browser, or using private browsing just to name a few. The ideal solution is a user system which would keep information about a user in a database and not be tied to any one browser instance. You’re in luck though because it’s on our road map and you can read about it here!