Skip to content

Data

The Data module allows saving and retrieving cached game data for logged-in users. This data will also be synchronized across all devices where the user plays the game.

If the user is not logged in, the Data module will store game data in LocalStorage. If the user logs in later, the game data in LocalStorage will be synchronously backed up to the user's account.

Warning

If you plan to use the Data module, do not forget to select the use of JogosSDK's Data module in the "How your game saves progress" form when submitting the game. Otherwise, the Data module will be disabled.

Using Cloud Synchronization for Game Data

After reading our SDK introduction page for your engine, follow these steps to use the data module.

Initialization

Before using any methods of the Data module, ensure that the SDK has been initialized.

Usage

javascript
// Coming soon
Avoid Losing User Progress
In general, it is a good practice to always retrieve data before setting it to ensure that the player's previous progress is not lost.

Guest Mode Behavior

For guest users, the Data module stores game data in localStorage. When a guest logs in, you do not need to perform any actions. Our SDK will automatically load the account's game data (if any); if the user has not played your game before, the SDK will transfer the guest data to the user's account. When the user logs out, the SDK will resume using the guest game data.

Data Saving Limits

The SDK will debounce data saving within 1 second, which means that after multiple calls to this method, data saving will be completed 1 second after the last call. In some cases, there may be exceptions where data saving may require a longer debounce time, up to 30 seconds. The data limit is 1MB. If you are about to reach this limit, a warning will be displayed in the browser console. If the data exceeds 1MB, it will no longer be backed up.

Data Module Help

If you are unsure how to use the Data module to save and load progress data, refer to the localStorage API, which works similarly to the Data module, to integrate the Data module into your released game.