Leaderboards
On the game page, you can show personalized leaderboards with the results of the best players and the authorized user's place in the ranking.
To make the queries described below work, check that a leaderboard has been created in the Developer Console.
Alert
If there is no leaderboard with the corresponding name in the Technical leaderboard name field in the Console, requests will return a 404 error.
Submitting a score
Alert
The request is available only for authorized users. It is recommended to request authorization in advance and use leaderboards only if the user has provided personal data.

Use the Set leaderboard score action to send a new score to the leaderboard with the 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, sending a score to the leaderboard might look like this:

Note
You can send a request no more than once per 1 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 via the Yandex Games SDK, after which a loop will start if the request is successful. This process takes some time.
It is recommended to keep a loading indicator on the screen while the process is running.
Warning
Make sure this loop is not called constantly. It is recommended to use it inside functions or triggers.

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