Game rating
You can ask the user to rate the game and write a comment in a pop-up window (will appear when requesting a rating, closing the background of the application). The pop-up window will not be shown if the user is not authorized or has rated the game before.
Before requesting a game rating, make sure the option is available to this user.
Checking the ability to request a rating
To find out if you can request a game rating, use the method
ysdk.feedback.can_review(callback: function)
callback: function
— the handler of the called method. Looks like this:
function(self, can_review: boolean, reason: string|nil): nil
-
can_review: boolean
— whether you can request or not. -
reason: string|nil
— the reason why you can't request a rating. Possible values:NO_AUTH
— The user isn't logged in.GAME_RATED
— The user already rated the game.REVIEW_ALREADY_REQUESTED
— A request was sent, now awaiting the user's action.REVIEW_WAS_REQUESTED
— A request was sent and the user performed an action (gave a rating or closed the pop-up window).UNKNOWN
— A request wasn't sent because an error occurred on the Yandex side.
Request rating
You can only request a game rating once per session. Be sure to use the method
ysdk.feedback.can_review()
before making a request.
To ask the user to rate the game, use the method ysdk.feedback.request_review()
.
ysdk.player.open_auth_dialog(callback)
callback: function
— the handler of the called method. Looks like this:
function(self, feedback_sent: boolean): nil
feedback_sent: boolean
— whether the user rated the game (true
) or closed the pop-up window (false
).
Example
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)