How to Save Data Without Logging In Using Local Storage & Cookies

I’m creating a stamp rally website, and I’ve managed to make it so that users can get a stamp by scanning a QR code. However, the stamps disappear when the page changes. I heard that it’s possible to save them using Local Storage and Cookies, but I don’t know how to use those properly, and I can’t get it to work. Could you please teach me how to do it?

hey s2j,

You can use Local Storage to save stamps in the browser so they persist across pages. When a QR is scanned, push the stamp ID to Local Storage, and on page load, read from Local Storage to display the stamps.

This way, users don’t need to log in, and their stamps won’t disappear when they navigate your site.

You’ll need to use a plugin. There’s no Bubble native way to use local storage.

1 Like

Yes, you can use a plugin, or if you have the toolbox, you can use 3 lines of code to do the same thing.

Not sure what a ‘stamp rally website’ is, though.

I have a referral program on my site and had experimented with using cookie storage…then just went to a custom state on the index page (on a single-page app). The referral code is used unless they leave the site. Statistically, only about 1 out of 20 leave without signing up.

I would imagine though, you’re having them sign up at some point and planning to store stamps, etc., in the database?

But, yes, you can use a plugin or, as I said, like 3 lines of code…whichever is easier for you

1 Like