Leaderboards
You can display personalized leaderboards on the game page with the best players' results and the authorized user's position in the ranking.
To make the requests described below work, make sure you have created a leaderboard in the Developer Console.
Submitting a score
Note
This request is only available to authorized users. It's recommended to use authorization in advance and use leaderboards only if the user has provided personal data.

Use the Set leaderboard score action to submit a new score to the leaderboard with the following parameters:
|
Parameter |
Type |
Description |
|
Name |
|
Technical name of the leaderboard. |
|
Score |
|
The player's score in the leaderboard. |
|
Additional data |
|
Optional metadata sent with the score. |
For example, submitting a score to the leaderboard might look like this:

Note
The request can be sent no more than once per second, otherwise it will be rejected with an error.
It's recommended to use score submission with a delayed event.

Leaderboard entries
To start working with the leaderboard, use the Fetch leaderboard action together with the trigger conditions Leaderboard is successfully fetched and Failure to fetch leaderboard. The action and conditions accept the following parameters:
|
Parameter |
Type |
Description |
|
Name |
|
Technical name of the leaderboard. |
|
Top positions |
|
Number of requested entries from the top of the leaderboard. |
|
Request player position |
|
Determines whether the user's position will be requested. |
|
Positions around the player's position |
|
Number of requested entries below and above the user in the table. |
The plugin will request leaderboard data through the Yandex Games SDK, after which a cycle will begin on a successful request. This process takes some time.
It's recommended to leave some loading indication on the screen while the process is running.
Warning
Make sure this cycle is not called constantly. It's recommended to use it inside functions or triggers.

Inside the cycle, you will have access to expressions from the Leaderboards list.
