Posted on 24. July 2024 by Jan Bunk
By default, your app will ask users to leave a review in the app stores a couple days after installation if they have opened the app several times by then. Do you want to customize this? Use our JavaScript API!
Here are some of the benefits of showing the review reminder manually:
You might want to disable the automatic review reminders if you'll be triggering them manually now.
executeWhenAppReady()
function of our app helper script. It ensures that your website doesn't try to interact with the app before it's ready or when your website is loaded using a regular browser (ReferenceError, function is not defined). showReviewReminder
Use this function to show the review reminder. If you're not using the native review reminder, it will return the button that the user clicked.
<script>
try {
let useNativeReviewReminder = false;
// These are the default texts. If you don't want to change them, you can also pass null and the app will
// default to them.
let title = "Please rate us!";
let message = "If you like this app, please take a minute of your time and leave us a positive review! It helps us out a ton. Thank you for your generosity!";
let rateButton = "Rate";
let noButton = "No thanks";
let laterButton = "Remind me later";
let clickedButton = (await showReviewReminder(useNativeReviewReminder, title, message, rateButton, noButton, laterButton))["clickedButton"];
switch (clickedButton) {
case "rate":
// The user clicked the button to rate the app.
break;
case "later":
// The user clicked the button to be reminded later.
break;
case "no":
// The user doesn't want to rate the app.
break;
}
}
catch (e) {
// Can occur if:
// - the app couldn't connect to the native code. Should be very unlikely.
console.log(e);
}
</script>
If you want to show the native review reminder dialog, only the first argument matters. Make sure to still pass a value for the other arguments though (even though their value is irrelevant).
<script>
try {
let useNativeReviewReminder = true;
await showReviewReminder(useNativeReviewReminder, null, null, null, null, null);
}
catch (e) {
// Can occur if:
// - the app couldn't connect to the native code. Should be very unlikely.
console.log(e);
}
</script>
Please keep in mind that the native review reminder is not guaranteed to show up. Here are potential reasons why it might not show up:
Unfortunately there is also no way to programmatically check if the native review reminder was shown.
Due to these limitations, I'd recommend that you test your code with the non-native dialog, where you can be sure that it will be displayed.