Game rating
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
To find out if you can request a rating, use the ysdk.feedback.can_review()
method.
ysdk.feedback.can_review(callback: function)
callback: function
— handler of the invoked method. It looks like:
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.
Rating request
Alert
You can only request a rating once per session. You must use the ysdk.feedback.can_review()
method before executing the request.
To ask the user for a rating, use the ysdk.feedback.request_review()
method.
ysdk.player.open_auth_dialog(callback)
callback: function
— handler of the invoked method. It looks like:
function(self, feedback_sent: boolean): nil
feedback_sent: boolean
— the user either 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)