Use same Custom States in different sites

Hi all,

I’m currently creating a website.
I provide a button, that the user can switch the language between german and english. I want to store the value in a custom state variable (text; “de”/“en”) and I want to deliver the correct text from the database. Works fine, but I designed my page in different single-pages for seo reasons.
so if the user clicks a link in the navigation bar, another site will load and the text will be shown.
Now, if the user clicks the language button, a custom state “lang” is set (e.g. “en”) and the workflow opens an external page, for example:

www.mypage.com/about

“about” is the slug. The page will load and I want to display the data (text) from the db, but my slug is empty after a new url is loaded. I thought, the custom state will be stored internal (cookie or so…) and I can use the value on another page again.
Is there a way to achieve this? I dont want to submit the lang-option in the url.

best,
jupxi

No… custom states are just page-level variables…

If you need to store data in a more persistent way then, aside from using the database, you can use local/session storage (or cookies)…

okay. thanks for this basic inforation :wink:
doesn bubble.io support cookies/local storage out of the box or do I have to use custom plugins or custom code?
any tipps?

The latter…

(although, unless your use case is for non-authenticated users, using the database for this would be the simplest, and most logical approach).

1 Like

I think it would be not useful to store data for every single visitor of my public website. :wink:

Why not? (Bubble does that already for you anyway).

But if your use case is for non-authenticated Users, then Local Storage is the way to go.

do you have any examples or links for this usecase?

is it possible to read/write a cookie/local storage-object and provide it in a Custom State or something that I can re-use the parameter in my bubble app (if is “en” then let =

Well there’s no need to use custom states if you’re using local storage.

Personally I’d just use a JavaScript to bubble element for this… but you can check out plugins such as Floppy if you want to simplify things.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.