Streaming live at 10am (PST)

Only Show Form To New Users


#1

Hello Webflow Community,

I’m wondering if anyone knows or could point me in the right direction in order to have a form that is only displayed to new users and hidden for existing, so they don’t see the popup everytime they go back to the page with the form?

Any assistance is greatly appreciated.

Best,
Tony



#2

Hi Tony!

To make something like this possible you will need to add some custom code and to interact with localStorage.

First of all, it is need to go to project settings -> custom code -> footer code


and add custom code like the following:

<script>
if (document.getElementsByClassName('myform') && document.getElementsByClassName('myform')[0]) {
  if (Boolean(localStorage.myFormFlag)) {
    document.getElementsByClassName('myform')[0].remove();
  } else {
    localStorage.myFormFlag = true;
  }
};
</script>

where myform is the class that is added to element, that needs to be shown to user only once (in my case text My form):

then if users will go to the site they will see it only once while visiting:

This method will work as long as the user is using the same browser on the same machine.


#3

Thank you soo much for the responsive response. Will definitely give this a shot