[Plugin Announcement]: Cookies

Perfect. Thanks

@BubbleSam
Sorry to be a pain. I have bought and installed the plugin but the actions aren’t showing. See screenshots below. I have closed down the editor and reopened.



I checked your demo app to validate where the workflow options should be.

Apologies if I am missing something obvious!

@myholidayguide
I think you just have to add Cookies element on your page

:roll_eyes: I should have known that!
Thanks

I used “read cookie” action to retrieve it :wink: So my first question is solved.

What I want to do is to save UUID in Cookies. That means I should save it once when a random user arrives on the site. I thought I can achieve it by save cookie only when ‘when cookie value is empty’. Is that correct? So far whenever I reload the page, it generate new UUID…


Just downloaded your plug in. I did use “write Cookies” to create value in workflow but can’t retrieve it…? Just wanted to display on the UI in order to see myself. Should I use “Read Cookie” action?


Hi @ohyoonkwn ,

You should read and write cookies by name.


We have a great example in our demo app (you’ll find links in the first post)

:wink:

Thanks @BubbleSam, Still trying to figure it out as the concept of saving data in user’s browser is new to me.

What I want to achieve is to identify unique user (without log in) and save a record in DB as well. So when the same user comes back to the app, the app should recognize.

First step is to save the cookie data in DB. In my workflow, it write & read cookie, and display it on browser, but not able to store in the DB. What am I missing here ?



How many values you are storing in user cookies? The easiest way is to read all of them one by one and store them in separate fields into your Database (instead of accessing the “All Cookies” property).

Currently I’m creating just one value. Strangely the cookies value aren’t stored in the new thing.

I passed it to State first (I checked the state has received the value), then pass that to DB. But still nothing is saved.

Actually you can check the actual cookie values stored in your browser. Here is the a tutorial for Chrome.

Yes, I want to store in user’s browser, so the app can identify the user when they’re back to the app again. To do that I think I have to save that cookie value in DB?

I don’t know what you are trying to achieve but probably you even don’t need to use cookies.
Assuming you want to use cookies, you should generate a unique id and store it into Bubble database and visitor’s cookies. Like this you will be able to read to cookie value and find the related database record.

That’s exactly I’m trying to do. What doesn’t work is to set a condition in workflow, not to write a new cookie if there’s an existing one under the same name.

How can I apply Cookie in “Only when” condition? I tried Cookie’s cookie is empty, but it doesn’t work as expected.

I tried different scenarios… and the flow involves Cookies behaves very strange.

When there’s cookie value, The plug in reads the value under the designated ID. I can see the value in browser inspection, and can display it on the screen. But the flow does not pass that actual value to State and DB. New thing is created with an empty field.

Sorry to hear that it still didn’t work…

I’ve just tried to create a simple app with the following algorithm:

  1. User opens the page
  2. READ cookie value (read by name)
    2.1. If it’s empty => WRITE a value (user id) in cookies (write by name)
    2.2. Else => display the value on the page

While it’s not exactly what you are trying to achieve (it doesn’t read/write the db), this algorithm works. I’m happy to help you but it’s hard to understand where the problem is without access to your app…

Hi Sam,

Yes I can replicate your flow (write & read Cookies). Can you try adjusting your flow by adding a step, storing that cookie value in a DB? In my case, that’s when things stop working.

1 Like

Hi @BubbleSam, a quick question that maybe has already been asked. Is it possible to use numbers as cookie values ? I need to store the number of users’ click and check if a max value is reached. Thanks.

SOLVED: I think I solved this using “convert to number” in the wf :slightly_smiling_face:

1 Like

Hi @stefanof , glad to head that you’ve found a solution!

Hi,

how can I use the cookie value as a date bubble can recognise when reading it?

At the moment, I save “current date” to the cookie, but when I read it, it’s. not considered as a date by bubble (even though it looks like a date).

Thx

Hi there,

Well you have to convert text to date. Check out this thread:

I hope it helps! :slight_smile: