> For the complete documentation index, see [llms.txt](https://manual.bubble.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.bubble.io/help-guides/data/temporary-data.md).

# Temporary data

{% hint style="danger" %}
Neither custom states nor URL parameters are encrypted, and both are accessible to the user in one way or another. **Don't use either to store sensitive information.**
{% endhint %}

Sometimes you need to store information temporarily in your app, without saving it to the database. Temporary data acts like a variable: it exists only as long as you need it, and it isn't stored permanently.

Bubble offers two kinds of temporary data, each with its own strengths: custom states and URL parameters.

<details>

<summary>What is a variable?</summary>

In programming, a variable is a named container that holds a value your app can read and change while it runs, like a total that updates as a user adds items to a cart. Bubble's temporary data works the same way: custom states and URL parameters hold values your app uses in the moment, rather than saving them to the database for the long term.

</details>

## Custom states

[Custom states](/help-guides/data/temporary-data/custom-states.md) are temporary variables you can store on any element in your app, including the page itself. A custom state can hold many kinds of data: text, numbers, dates, [static data](/help-guides/data/static-data.md) from an [option set](/help-guides/data/static-data/option-sets.md), or [dynamic data from your database](/help-guides/data/the-database.md).

When you set up a custom state, you define its data type and whether it holds a single value or a list. You update custom states through workflows, and in some cases you can give them a default value. There's no limit to how many you can create.

Because they're temporary, custom states reset when the page reloads.

{% content-ref url="/pages/EFbhWvI7KdITWtMamUHI" %}
[Custom states](/help-guides/data/temporary-data/custom-states.md)
{% endcontent-ref %}

## URL parameters

[URL parameters](/help-guides/data/temporary-data/url-parameters.md) are text values you add to your app's URL to store and pass information. Because they live in the URL, they stay visible and available when a page is shared or reloaded.

Parameters follow a [**key-value pair**](#user-content-fn-1)[^1] structure: each one has a name (the key) and a value. They're added to the URL after a question mark (`?`), and multiple parameters are separated by an ampersand (`&`).

```url
https://www.mydomain.com/page?parameter1=value1&parameter2=value2
```

Everything after the `?` makes up the URL parameters. They're useful for navigation, since they let users move between states with the browser's *back* button.

{% content-ref url="/pages/45paecU4jIMLUMYn1R51" %}
[URL parameters](/help-guides/data/temporary-data/url-parameters.md)
{% endcontent-ref %}

## Custom states versus URL parameters

Both store temporary data, but they behave differently, and each suits different situations.

<table><thead><tr><th width="205.390625"></th><th>Custom states</th><th>URL parameters</th></tr></thead><tbody><tr><td>On page reload</td><td>Reset</td><td>Kept, but may disappear if a workflow changes the URL or the user removes them</td></tr><tr><td>Visibility</td><td>Invisible to the user (but not encrypted, and not for sensitive data)</td><td>Visible in the browser's URL bar</td></tr><tr><td>Values</td><td>Can hold a single value or a list</td><td>One parameter holds a single value</td></tr><tr><td>Default value</td><td>Can have one at page load, depending on the data type</td><td>Must be set by a workflow, or by the user</td></tr><tr><td>Who can change it</td><td>Only through workflows you set up</td><td>The user, by editing the URL or using navigation like the back button</td></tr><tr><td>Shareable</td><td>No, they're local to the session</td><td>Yes, since they're part of the URL</td></tr></tbody></table>

### When to use which

Use a **custom state** when:

* The value is internal to how the page works, like which tab is open or which items a user has selected
* You need to hold a list of values
* You don't want the value to appear in the URL

Use a **URL parameter** when:

* You want the value to survive a page reload or be shareable through a link
* You're passing information from one page to another
* You want users to be able to navigate between states with the back button

[^1]: A key value pair is a way of storing data. It consists of a **key** and a **value**.\
    \
    In the context of URL parameters, the *key* is the name of the parameter, and the *value* is the value. For example:\
    \
    `?name=john&age=56`

    In this example, the *keys* are `name` and `age`, and the values are `john` and `56`
