# User Data

Store and manage player data to enhance gameplay experience and retain progress.

There are two types of storage: `LocalStorage` and `PlatformInternal`. When writing to local storage, data is saved on the player's device. When writing to internal storage, data is saved on the platform's servers.

{% hint style="warning" %}
If you need to call storage methods in a sequence, make sure you wait for previous call to finish, so there is no potential data collisions.&#x20;
{% endhint %}

#### Default Storage Type

Identify the default storage type to understand where data is being saved (local or server).

```javascript
PlaygamaBridge::DefaultStorageType()
```

Used automatically if a specific type is not specified when working with data. Possible values: `LocalStorage`, `PlatformInternal`.

#### Support Check

Verify if the specified storage type is supported on the platform to ensure compatibility.

<figure><img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2F3fWfRUuF2d08eJTH0AbA%2FScreenshot%202025-01-21%20at%2011.50.31.png?alt=media&#x26;token=0cdee98f-fe06-4f83-b5a6-1ff5a86d4617" alt=""><figcaption></figcaption></figure>

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsStorageSupported"},"parameters":["","\"platform_internal\"",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Platform internal storage supported\"","\"info\"",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsStorageSupported"},"parameters":["","\"local_storage\"",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Local storage supported\"","\"info\"",""]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>

Ensure the platform supports the required features and storage types for proper functionality.

#### Storage Accessibility Check

Check if the specified storage type is currently available for use to manage data storage effectively. Possible values: `true`, `false`.

<figure><img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2FwPMHW8ufqbSN7a4nNSYq%2FScreenshot%202025-01-21%20at%2011.52.33.png?alt=media&#x26;token=be18acc2-6ea1-49ca-84d4-93e438a231f3" alt=""><figcaption></figcaption></figure>

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsStorageAvailable"},"parameters":["","\"platform_internal\"",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Platform internal storage available\"","\"info\"",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsStorageAvailable"},"parameters":["","\"local_storage\"",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Local storage available\"","\"info\"",""]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[{"type":{"value":"PlaygamaBridge::IsStorageSupported"},"parameters":["","\"local_storage\"",""]}],"conditionsCount":1}}
```

</details>

#### <img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2F9BooaofCI33U9Np5oeif%2FFrame%203%20(1).png?alt=media&#x26;token=0750b56a-a069-4759-bda9-29951f06cd30" alt="" data-size="line"> Load Data

Retrieve stored data based on a key or multiple keys to restore player progress or settings.

<figure><img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2F4MPnHQeUAwzPtglXII51%2FScreenshot%202025-01-21%20at%2011.59.13.png?alt=media&#x26;token=8e652603-5814-4538-a8b3-ca647eeaf833" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If you need data in JSON format, use the `PlaygamaBridge::StorageDataKeyAsJSON("key_1")` expression.
{% endhint %}

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["Button",""]}],"actions":[{"type":{"value":"PlaygamaBridge::AppendStorageDataGetRequest"},"parameters":["","\"key_1\"",""]},{"type":{"value":"PlaygamaBridge::AppendStorageDataGetRequest"},"parameters":["","\"key_2\"",""]},{"type":{"value":"PlaygamaBridge::SendStorageDataGetRequest"},"parameters":["","\"default\"",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnStorageDataGetRequestCompleted"},"parameters":["",""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::HasStorageData"},"parameters":["","\"key_1\"",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["PlaygamaBridge::StorageDataKey(\"key_1\")","\"info\"",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::HasStorageData"},"parameters":["","\"key_2\"",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["PlaygamaBridge::StorageDataKey(\"key_2\")","\"info\"",""]}]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>

#### <img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2F9BooaofCI33U9Np5oeif%2FFrame%203%20(1).png?alt=media&#x26;token=0750b56a-a069-4759-bda9-29951f06cd30" alt="" data-size="line"> Save Data

Save data to the specified storage with a key to retain player progress or settings.

<figure><img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2FoYlWl4ers5C9rnYwUOtx%2FScreenshot%202025-01-21%20at%2012.36.50.png?alt=media&#x26;token=291c9d64-ddd0-4d4b-aded-c174a62451a1" alt=""><figcaption></figcaption></figure>

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["Button",""]}],"actions":[{"type":{"value":"PlaygamaBridge::AppendStorageDataSetRequest"},"parameters":["","\"key_1\"","\"42\"",""]},{"type":{"value":"PlaygamaBridge::AppendStorageDataSetRequest"},"parameters":["","\"key_2\"","\"test\"",""]},{"type":{"value":"PlaygamaBridge::SendStorageDataSetRequest"},"parameters":["","\"default\"",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnStorageDataSetRequestCompleted"},"parameters":["",""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsLastActionCompletedSuccessfully"},"parameters":["",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Data Saved!\"","\"info\"",""]}]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>

#### Delete Data

Remove data from the specified storage by key to manage player data and settings effectively.

<figure><img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2FEQJcnD9u44cZQvGACDR8%2FScreenshot%202025-01-23%20at%2012.30.57.png?alt=media&#x26;token=c0386683-06d1-47d7-b696-cbd0f495200b" alt=""><figcaption></figcaption></figure>

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["Button",""]}],"actions":[{"type":{"value":"PlaygamaBridge::AppendStorageDataDeleteRequest"},"parameters":["","\"key_1\"",""]},{"type":{"value":"PlaygamaBridge::AppendStorageDataDeleteRequest"},"parameters":["","\"key_2\"",""]},{"type":{"value":"PlaygamaBridge::SendStorageDataDeleteRequest"},"parameters":["","\"default\"",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnStorageDataDeleteRequestCompleted"},"parameters":["",""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsLastActionCompletedSuccessfully"},"parameters":["",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Data Deleted!\"","\"info\"",""]}]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>
