---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://yandex.com/dev/games/doc/en/sdk/defold/game-review.md
  - https://yandex.com/dev/games/doc/hi/sdk/defold/game-review.md
  - https://yandex.com/dev/games/doc/ko/sdk/defold/game-review.md
  - https://yandex.com/dev/games/doc/ru/sdk/defold/game-review.md
  - https://yandex.com/dev/games/doc/tr/sdk/defold/game-review.md
  - https://yandex.com/dev/games/doc/vi/sdk/defold/game-review.md
  - https://yandex.com/dev/games/doc/zh/sdk/defold/game-review.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/games/doc/en/llms.txt

# Game rating

<!-- source: en/_includes/script-common.md -->
<!-- source: en/_includes/script/index-js.md -->

<!-- endsource: en/_includes/script/index-js.md -->

<!-- source: en/_includes/script/requirements-js.md -->

<!-- endsource: en/_includes/script/requirements-js.md -->

<!-- source: en/_includes/script/image-modal-js.md -->

<!-- endsource: en/_includes/script/image-modal-js.md -->
<!-- endsource: en/_includes/script-common.md -->

You can ask users to rate your game and write a comment in a pop-up window (it appears when you ask for the game to be rated, overlaying the app background). The pop-up window isn't displayed to logged-out users or those who rated the game before.


Before asking for a game review, make sure that this option is available for the user.

## Check whether the rating option is available {#can-review}

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

```lua
ysdk.feedback.can_review(callback: function)
```

`callback: function` — handler of the invoked method. It looks like:

```lua
function(self, can_review: boolean, reason: string|nil): nil
```

- `can_review: boolean` — whether it is possible to request or not.
- `reason: string|nil` — the reason why an ad cannot be requested. Possible values:

    - `NO_AUTH` — the user is logged out.
    - `GAME_RATED` — the user has already rated the game.
    - `REVIEW_ALREADY_REQUESTED` — the request has already been sent, not 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 popup.
    - `UNKNOWN` — the request couldn't be sent, an error occurred on the Yandex side.

## Review request {#review-request}

{% note alert %}

You can only request a review once per session. You must use the `ysdk.feedback.can_review()` method before executing the request.

{% endnote %}

To ask the user for a review, use the `ysdk.feedback.request_review()` method.

```lua
ysdk.player.open_auth_dialog(callback)
```

`callback: function` — handler of the invoked method. It looks like:

```lua
function(self, feedback_sent: boolean): nil
```

- `feedback_sent: boolean` — the user either rated the game (true) or closed the pop-up window (false).

**Example**

```lua showLineNumbers
ysdk.feedback.can_review(function (self, can_review, reason)
  if can_review then
    ysdk.feedback.request_review(function (self, feedback_sent)
      if feedback_sent then
        print("Reward")
      end
    end)
  else
    print(reason)
  end
end)
```

---


<!-- source: en/_includes/button-git.md -->
<a href="https://github.com/yandex-games-plugins/defold">
  <span class="button">Repository</span>
</a>
<!-- endsource: en/_includes/button-git.md -->
