Well Rated AppHow can you make your app more visible in the Windows Store and boost your downloads?  As we describe in the App Promotion Checklist, collecting user feedback can be accelerator for driving app downloads. In this blogpost I’m going to cover how to integrate collecting user feedback in your Windows Store app.

Often users tend to forget about reviewing and rating the apps their using.  The approach we’re taking in this post is to remind the user about this after he/she has been using the app for a while.  First of all, the user will have experience with the app and will be able to provide more valuable and realistic feedback.  Secondly, a user that has been using the app is likely to be a happy user; hence, the feedback will likely be more positive which can ultimately raise your visibility in the Store Glimlach.  A word of warning, make sure not to be too pushy in prompting the user for reviewing your app: stick to a limited number of reminders or your initially happy user could give you negative app review.

The overall flow of the process is as follows, we’ll go in more detail in the code sample:

  1. Keep track of the app usage in a counter
  2. Increment the counter as the user uses the app
  3. When we hit a threshold, prompt the user for feedback
  4. Direct the user to the Windows Store to review the app
  5. Otherwise, continue to step 1

 

RatingNotifier class

To limit the impact on existing source code and to allow for easily reusing it, we’re encapsulating the user rating code in a separate class RatingNotifier:

   1: public class RatingNotifier
   2: {
   3:     /// <summary>
   4:     /// Triggers the rating reminder logic. Checks if we have surpassed the usage threshold and prompts the user for feedback if appropriate.
   5:     /// </summary>
   6:     public async static Task TriggerNotificationAsync(string title, string message, string yes, string no, string later, int interval, int maxRetry)
   7:     {
   8:         // Notification logic comes here
   9:     }
  10: }

 

Tracking the usage

To manage the user feedback, we rely on three settings:

  • counter: tracks the app usage – in this example, we’re tracking the number of visits to the app’s main page. Alternatively you could track the number of times the user has launched the app
  • rated: boolean value that indicates if the user has already rated the app
  • retryCount: tracks how many times we’ve prompted the user already – after a predefined number of reminder we back off.

These settings are stored in the roaming app storage via the RoamingSettings class.  By doing so, the underlying sync engine ensures that the settings roam across each of the user’s devices automatically. If a user rates the app on one device, and then logs onto another device, you don’t want to remind him again. You could also use the roaming app storage for keeping track of other app settings, for example to store the user’s preferences or for keeping track of a high score, etc.

Note that there is a limit to how much data you can store in roaming storage for the syncing to work – this is defined in RoamingStorageQuota.

   1: // Initialize settings
   2: var counter = 0;    // usage counter
   3: var rated = false;  // indicate if rating has happened
   4: var retryCount = 0; // number of times we've reminded the user
   5:  
   6: // Use roaming app storage to sync across all devices
   7: var settingsContainer = ApplicationData.Current.RoamingSettings;
   8:  
   9: // Retrieve the current values if available
  10: if (settingsContainer.Values.ContainsKey(IsRatedKey))
  11:     rated = Convert.ToBoolean(settingsContainer.Values[IsRatedKey]);
  12: if (settingsContainer.Values.ContainsKey(RatingRetryKey))
  13:     retryCount = Convert.ToInt32(settingsContainer.Values[RatingRetryKey]);
  14: if (settingsContainer.Values.ContainsKey(RatingCounterKey))
  15:     counter = Convert.ToInt32(settingsContainer.Values[RatingCounterKey]);
  16:  
  17: // Increment the usage counter
  18: counter = counter + 1;
  19:  
  20: // Store the current values in roaming app storage
  21: SaveSettings(rated, counter, retryCount);

As you can see, upon every call to TriggerNotificationAsync, we increment the usage counter and persist it to roaming storage.

 

Should we ask for feedback

Now that we’ve incremented the usage counter, we need to determine if we will prompt the user for reviewing the app. This is where the three settings come into play.

First of all, we check if the app has already been rated, in which case we don’t prompt.  Secondly, we verify if we have not yet exceeded the maximum number of reminders. Finally, we check the usage counter to check if we have passed a given interval – for example, remind the user after every 15 times he/she visited the app’s main page.

   1: // Do we need to ask the user for feedback
   2: if (!rated &&                                   // app was not rated
   3:     retryCount < maxRetry &&                    // not yet exceeded the max number reminders (e.g. max 3 times)
   4:     counter >= interval * (retryCount + 1))     // surpassed the usage threshold for asking the user (e.g. every 15 times)
   5: {
   6:     // Prompt the user
   7: }

 

Ask for feedback

All conditions are met to ask the user for rating the app now.  To do this, we’ll display a MessageDialog dialog asking if the user wants to review the app.  If agreed, we redirect to the Windows Store app to show the rate and review page of our app. We achieve this by navigating to a ‘special’ URL, a so-called Windows Store protocol link (source code line 12).

If the user decides not to rate the app we just update the reminder counter (code not shown here).

   1: // Create a dialog window
   2: MessageDialog md = new MessageDialog(message, title);
   3:  
   4: // User wants to rate the app
   5: md.Commands.Add(new UICommand(yes, async (s) =>
   6: {
   7:     // Store the current values in roaming app storage
   8:     SaveSettings(true, 0, 0);
   9:  
  10:     // Launch the app's review page in the Windows Store using protocol link
  11:     await Launcher.LaunchUriAsync(new Uri(
  12:         String.Format("ms-windows-store:REVIEW?PFN={0}", Windows.ApplicationModel.Package.Current.Id.FamilyName)));
  13: }));
  14:  
  15:  
  16: // Prompt the user
  17: await md.ShowAsync();

 

Triggering the counter

Now that we have all the logic to track the settings and to decide when to ask the user for feedback, all that’s left is to invoke this logic from the actual app logic. In this post we’ll be tracking the number the number of times the user visits the app’s main page. In order to do so, we invoke the TriggerNotificationAsync method from the Page_Loaded event handler of the app’s main page (e.g. GroupedItemsPage.xaml.cs).

   1: private async void Page_Loaded(object sender, RoutedEventArgs e)
   2: {
   3:     //
   4:     // trigger rating notification
   5:     //
   6:     await RatingNotifier.TriggerNotificationAsync(
   7:         Convert.ToString(Application.Current.Resources["RatingTitle"]),
   8:         Convert.ToString(Application.Current.Resources["RatingMessage"]),
   9:         Convert.ToString(Application.Current.Resources["RatingYes"]),
  10:         Convert.ToString(Application.Current.Resources["RatingNo"]),
  11:         Convert.ToString(Application.Current.Resources["RatingLater"]),
  12:         Convert.ToInt32(Application.Current.Resources["RatingInterval"]),
  13:         Convert.ToInt32(Application.Current.Resources["RatingMaximumRetries"]));
  14: }

Alternatively, you could invoke this logic when launching the app.  In that case, you would add the call to TriggerNotificationAsync in the OnLaunched event handler of the App.xaml.cs file.

 

Conclusion

You can find the full RatingNotifier class online: http://sdrv.ms/1cEO63S.

Hopefully with this code you can collect lots of valuable user ratings and feedback, which may in turn boost your visibility and downloads in the Windows Store.

For more tips on promoting your app in the Store, check our ultimate checklist.