I was going through the tutorial section and been playing with bubble pretty much every day
One of my question was: If I use the saving data tutorial, will the data be saved like “forever” somewhere on a database of bubble or will it just save data in a variable which will be cleared as soon as the page got closed?
Why am I asking this:
Step1: I want to save users “session ID” (I’ve found the variable within bubble) and I want to permanently save it somewhere (Also installed API connector but don’t know how to put it to use)!
Step2: I want my page, everytime it gets loaded, to check whether the current session ID of the user is saved in my database or not!
I don’t wanna use the login /signup feature at this point (in case someone asks).
Interesting idea - where did you find the session id?
You can save it to a permanent database and query the database field when someone visits your site to see if their session id matches. You just need to find the right condition on page load to check against the database = I’m not certain where that is.
It should be pretty easy what data tables have you already created to make your app run? It seems to make most sense to me to add that to the user table. So just goto the user table and a field for session id.
You can then set a workflow to save this id this to the appropriate table. Most probably on page load.
I havent even created a database since I don’t really know how. I went through the “saving data tutorial” - is that what you meant with creating a database? I thought the video just shows how to create ( temporary) variables
Hey thanks, I went through them, still doesn’t really answers my question so I will ask again.
is the “saving data” tutorial the one that I need for “creating databases” or will it just create temporary variables that will get deleted after the page refreshes?
Using the database for the bubble app, the same way as for stored data … in the editor choose Data, Data Types
Pick User, and
Then it is accessed as Current User’s SomethingUseful. Can save data into it either with autobinding to an input element, or in a workflow action doing "Make changes to User, SomethingUseful = Input’s value.
If the user is logged in, the value will get stored in the database. If the user is not logged in, it will behave as if it is stored, but is local to the browser, and disappear after being unused for 3 days. I haven’t tested the disappearing trick yet.
Looking again at your first post, I think what might suit better is saving the user’s IP address, and check if it exists in the database to see if you get a repeat visitor.
If you want to do this, add another plugin “ipiphy”. Create a new “Data Type” (effectively a database table), like VisitorInfo. In this data type, create a text field “IP address”. Then can have a workflow event “when page is loaded” and "search for VisitorInfo (constraint: IP address = Current User's IP address) :count = 0, then it can do the actions you want for new visitors.