How can I store user data without loggin in?


I would like to create an application, lets say I want to sell chickens. The user open the web application from his phone. They should get a unique Id without logging and be able to see only their cart until the session ends without logging in. Is there any possible solution with bubble for that?

yes, you can rely on the built in functionality of cookies that Bubble provides out of the box which are valid for 72 hours…if you need longer, you’d need another approach, which may be a plugin that allows you to store data in the browser or local storage.

72 hours would be perfectly enough, but could you please give me any information how to do that? I tried to google around it but i got confused.

Nothing special needed. Just use the action ‘make changes to current user’ as normal.

The changes you make will apply to logged out users similarly to logged in users, the main difference being that the changes will be lost after 72 hours. Another caveat is that you cannot see the data of these non-logged in users on the ‘App Data’ tab. These users don’t appear on the users table.

In bubble terms, logged out users to which you’ve made changes are called ‘temporary users’. You can look up more information about them on the bubble manual.

If you use the action ‘Sign the user up’ on a temporary user, all the data that you saved on to them will remain on the now signed-up user. However, if the temporary user Logs in to an existing account instead of Signing Up, the data will be lost.

I tried to display a bunch of products and I used a condition as only visible if “current user’s unique id = item cart’s item list’s unique id”, but i can see it from any session. I tried it from desktop and phone but both see the same.

Also for example if i show the total price of the cart item’s as the current user’s cart’s list of items it shows the same from both session, for example if i add the item from the desktop i can still see the amount from the phone.

This would be a reference to the products in your cart list unique ids, not the users unique id

You should use a constraint on the Cart data type to be, creator = current user, however, if the user doesn’t log in or create an account within 72 hours of creating their cart, then your creator would be empty.

It should only work for a few hours so its fine. Thanks for your help i will try.

Okay so, I see this Creator = User , but if I add the item to the cart without beeing logged in, it still do not recognize the user. If i use it from a different Pc it recognize it as the same user.

Are you saying that you would like to allow people to add an item to the Cart on the phone, and then seeing that item in the cart on the PC?

No, I wanted them to not see it. But managed to make it . I did put a filter on the repeating group (showing the cart items) as " Created By = Current User.
I marked the previous comment as a solution I just got confused a bit there.