I am looking to implement an affiliate feature and want to get argument from url and save cookie on visitors computer and then latter check for value on conversion.I see how to get value from get request but not how to save data to user/visitors cookies
You can use the “Get ? parameter from page URL” feature. Give your affiliate links a parameter, ex: yourdomain.com/yourpage?source=affilate1
Then you can capture the parameter you set which would be “source” and when you run it “affilate1” will be captured and you can add it to the (example) User’s Source data field.
Adding to what @peng.o said,
You can save information to Current User, even if they are not signed in. This essentially is saving it to their cookies.
https://books.bubbleapps.io runs entirely off the users cookies. Add a book and come back, the book should still be there and you don’t even have to be logged in.
The downside to using cookies, is that it will erase within a month (give or take for different browsers). So I still had added the ability to save to the database. But for what you want to do, it should be enough time until they either create an account so you can save the affiliate link to the logged in user or until they purchase.
Send data to page
Thanks. This was very helpful!
How do I set a cookie when the user pressed a button?
We don’t expose that to users (a little bit too technical & low-level for Bubble). What is the use case?
I want to let users use a kind of booking service without logging in. I bit like doodle.com. When they click the link to the booking the first time they are prompted to enter their preference. Using the link again takes them to a summary page viewing all persons entries for that booking. My thought was to use a cookie to set a state when they have entered their prefs and redirect them to the summary page.
Then you should just modify the current user, it will just work
Ok. Thanks! Will try that. Searched the Ref for info on users to understand the mechanics. Couldn’t find it. I’m I looking in the wrong place?
PS. Do you have tip on an dev environment more suitable for me as an ex OO programmer, doing some simple database webb apps?
How long is data stored on a user who isn’t logged in?
We currently delete non signed up users if we haven’t seen them for 3 days.
The problem with this Current User approach for temporary data is that if the user IS logged in then this is writing to the database and counting as a workflow.
How do we handle genuine temporary data that does not need to hit the database, but needs to be retained during page changes etc. without passing through URL parameters.
We don’t support this then.
Have there been any updates to the way Bubble handles cookies this past year @emmanuel
Regarding the current setup, if we are driving affiliate traffic and tracking the source when the users haven’t logged in or signed up yet, but then they signup at some point in time thereafter and outside of the 3 day window where Bubble saves the information under the current user (even though they don’t exist) how do we associate a source to the user the moment they eventually sign up?
Perhaps allowing bubble users to create a special Thing type that saves user data like a cookie for 30/60/90 days would be good.
There hasn’t been updates there.
Any updates on this now?
There’s now a good plugin that save Session and/or Local values. It works great.
Name : Browser Storage (plugin).
Do note that you may or may not truly have a need to write cookies. The way Bubble handles “Current User” takes care of most situations where you might think you need to write cookies. YMMV, as in all things.