In-app Ratings module helps improve app rating by allowing you to customize the appropriate location and time for prompting users to rate your application. Refer to this user guide to configure in-app ratings in the Apptics web console.
Add the SDK
- Before your begin, make sure that Apptics is integrated into your project by following the Integration Guide.
Use AppticsInAppRating instance
Copiedimport 'package:apptics_flutter/rateus/apptics_in_app_rating.dart'';
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
// To check and show a new rating alert pop-up, call the checkForRatingPop method.
AppticsInAppRating.instance.checkForRatingPop(context);
// return your widget;
}
}
- To activate the 'Send Feedback' option, set the isFeedbackEnabled to true.
CopiedFuture<void> checkForRatingPop(BuildContext context, {bool isFeedbackEnabled = false})`
- Invoke the above method after setting the theme and creating the navigator in your Flutter app.
- The in-app Rating functionality doesn't support Material3 for Flutter.
The rating pop-up will be shown automatically as per the configuration done in the Apptics web console. The default pop-up will have two or three options depending on the availability of Apptics feedback module dependency.
- 'Rate in PlayStore' will redirect the users to the Play Store where they can add their review and ratings for your app.
- 'Later' action will allow the users to dismiss the rating pop-up. The pop-up will be shown again after a certain period automatically.
- 'Send Feedback' will only appear if Apptics' feedback SDK is integrated with your app. Send Feedback will direct the users to the Apptics feedback activity.
Note: Make sure that you have used the Apptics theme, else the app will crash.
- If the user chooses 'later' option in the pop-up, the next prompt will be deferred by 10 days (default).
- Use the below method to customize the number of days to defer the prompt.
CopiedAppticsInAppRating.instance.daysBeforeShowingPopupAgain = // days as int;
- If the user chooses 'Later' option for three consecutive times, the rating pop-up will not be shown again until the criteria is reconfigured in the Apptics console.
- Use the below method to customize the maximum number of prompts.
CopiedAppticsInAppRating.instance.maxTimesToShowPopup = //number as int
Customize default ratings pop-up
Use the below method to build and show a custom rating pop-up.
Copied import 'package:apptics_flutter/rateus/apptics_in_app_rating.dart'';
await AppticsInAppRating.instance.getCriteriaId();
- The above method will return the criteriaId, you can use the same criteriaId to construct your own UI. If the criteriaId is available, you can display your UI. The method operates asynchronously.
- Call the sendStats method to send the stats to Apptics server.
- The value of an action param can be RATE_IN_STORE_CLICKED, SEND_FEEDBACK_CLICKED, or LATER_CLICKED enum depending upon whether the button is clicked is to:
- Rate the app
- Go to the feedback screen
- Dismiss the dialog
Copied import 'package:apptics_flutter/rateus/apptics_in_app_rating.dart'';
AppticsInAppRating.instance.sentStats(criteriaId: criteriaId, popupAction: PopupAction.LATER_CLICKED);
Google Play in-app review API
Use the below snippet if you prefer using Google Play's in-app review system instead of Apptics' ratings pop-up.
Copiedimport 'package:apptics_flutter/rateus/apptics_in_app_rating.dart'';
AppticsInAppRating.instance.setShowStoreAlertOnFulFillingCriteria(true);
Enabling this will automatically present Google Play's in-app review system once the configured criterion is fulfilled.
Google Play review API doesn't have a callback to know whether the review UI is presented or not.
The Review API quotas are not well defined in the documentation. So, once the configured criterion is fulfilled and the Review API is invoked we will automatically defer the next review API call with respect to the value set in daysBeforeShowingPopupAgain.
Note: Refer to this link to troubleshoot in case of using Google's in-app ratings.