Game rating

You can ask the user to rate the game and leave a comment in a pop-up window. It will appear when the rating is requested.

Before requesting a game rating, make sure the option is available for this user: they must be authorized and have not rated the game before.

For more information about working with ratings, see the page Reviews.

Checking whether requesting a rating is available

To find out if you can request a game rating, use the ysdk.feedback.canReview() method.

It returns a Promise<Object> that changes its state to resolved. The returned object contains the value key set to true/false, which you can use to see whether a rating request is possible:

Value

Description

value: true

You can request a rating.

value: false

You cannot request a rating.

The reason for rejection is returned as a string in the reason key:

  • NO_AUTH: The user is not logged in.
  • GAME_RATED: The user has already rated the game.
  • REVIEW_ALREADY_REQUESTED: The request has already been sent, awaiting the user's action.
  • REVIEW_WAS_REQUESTED: The request has already been sent, the user has taken action by either rating your game or closing the pop-up window.
  • UNKNOWN: The request was not sent, an error occurred on the Yandex side.

Rating request

Alert

You can only request a game rating once per session. Be sure to use the ysdk.feedback.canReview() method before executing the request.

To ask the user to rate the game and write a comment, use the ysdk.feedback.requestReview() method.

It returns a Promise<Object> that changes its state to resolved. The returned object contains the feedbackSent key set to true/false. You can determine the user's action from it:

Value

Description

feedbackSent: true

The user rated the game.

feedbackSent: false

The user closed the pop-up window.

If you did not use the ysdk.feedback.canReview() method before executing the request, the value feedbackSent: false may be accompanied by the use canReview before requestReview error.

Example

1const ysdk = await YaGames.init();
2
3const { value, reason } = await ysdk.feedback.canReview();
4
5if (value) {
6    const { sentFeedback } = ysdk.feedback.requestReview();
7} else {
8    console.log(reason);
9}

Note

Support staff help you publish a ready-made game on the Yandex Games platform. For applied questions about development and testing, other developers will answer in the Discord community.

If you encounter a problem or have a question while using the Yandex Games SDK, contact support:

Write to chat