Skip to content

Use case: automatically reward users based on events in the app

Overview

Receive Reward Push Notification

Reward users automatically based on the events inside the application. For instance, you can:

  • Reward user for doing a certain action in the application, e.g., reaching level X, beating the high score.
  • Reward user for being socially active, e.g.. posting on Activity Feed, sending Smart Invites.
  • Provide a reward for inviting friends, only when they perform a certain action (reach the level, do the first IAP) in the app.
  • Re-engage user after being in-active for some time, for instance you can send a notification with a special offer if user did not use the app for 7 days.

Implementation guide

As an example let’s implement rewarding user (User A) for inviting friends to the game, only when a friend (User B) installs the app and reaches level 5 in the game.

Implementation Flow Diagram

0. Prerequisite

  1. Integrate GetSocial SDK. Check the detailed guide on Android, iOS or Unity.

  2. Setup push notifications. Check the detailed setup guide on Android, iOS or Unity.

  3. Allow inviting friends to the app. Integrate Smart Invites to provide User A a way to invite his friends. See the detailed guide for Android, iOS or Unity.

1. Automate rewarding

To automate rewarding, we have to let GetSocial know that User B reached level 5 and sent a notification with a reward attached to User A.

Prepare application to receive several reward types

To enable higher flexibility we recommend configuring an application in a way it can receive a couple of reward types. For instance, on the app side you can implement receiving “receive-gold-reward” and “receive-item-reward” and configure what reward will be given and “how much gold” or “what item” will be rewarded from the GetSocial Dashboard.

  1. Inform GetSocial when the user performs the desired action. You have two options:

    • You can send a custom GetSocial Analytics event:

      1
      2
      3
      4
      Map<String, String> properties = new HashMap<>();
      properties.put("level", "5");
      
      GetSocial.trackCustomEvent("level_achieved", properties);
      
      1
      [GetSocial trackCustomEventWithName:@"level_achieved" eventProperties:@{@"level": @"5"}];
      
      1
      GetSocial.trackCustomEvent(withName: "level_achieved", eventProperties: [ "level": "5" ])
      
      1
      2
      3
      4
      5
      6
      var properties = new Dictionary<string, string>
      {
          {"level", "5"}
      };
      
      GetSocial.TrackCustomEvent("level_achieved", properties);
      
    • Or set a public user property:

       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      String userLevel = ... ; // Get user level
      GetSocial.User.setPublicProperty(
          "level", userLevel,
          new CompletionCallback() {
              @Override
              public void onSuccess() {
                  Log.i("GetSocial", "User property successfully set");
              }
      
              @Override
              public void onFailure(GetSocialException exception) {
                  Log.e("GetSocial", "Failed to set user property, error: " + exception.getMessage());
              }
          }
      );
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      NSString *level = ... ; // Get user level
      [GetSocialUser setPublicPropertyValue:level
              forKey:@"level"
              success:^{
                  NSLog(@"User property successfully set");
              }
              failure:^(NSError *error) {
                  NSLog(@"Failed to set user property, error: %@", error.description);
              }];
      
      1
      2
      3
      4
      5
      6
      let level: String = ... // Get user level
      GetSocialUser.setPublicPropertyValue(level, forKey: "level", success: {
          print("User property successfully set")
      }, failure: { (error : Error) in
          print("Failed to set user property, error: \(error.localizedDescription)")
      })
      
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      string userLevel = ... ;// Get user level
      GetSocial.User.SetPublicProperty(
          "level", userLevel,
          () =>
          {
              Debug.Log("User property successfully set");
          },
          error =>
          {
              Debug.LogError("Failed to set user property, error: " + error.Message);
          });
      

    What approach is better depends on the nature of the event, for instance, reporting that user has beaten the high score is better done by tracking custom analytics event, tracking the current user level better suits for a public user property.

  2. Automate reward using Smart Flows. Smart Flows is a GetSocial Dashboard feature that allow setting up automation of the various tasks using trigger-action rules. We have to set up a rule as follows:

    • Trigger: listen for level_achieved event, when event occurs and level property will be 5 do an action.
    • Action: get the user who invited the current user, and send him a notification “Congrats, your friend reached level 5. Click to receive 500 coins as a referral bonus.”, attaching the data about the reward.

    In other words, as soon as User B reaches level 5, the rule we set up above automatically trigger and send a notification with a reward to User A.

2. Receive notification

Receiving the notification and handling notification click to issue the reward is the same for all use cases. Please follow the “Receive notification” implementation guide in the Send/request access to group/clan/challenge/gifts use case for details.

Try it out

Download DevFest Ukraine conference application to check out the demo how to automate user rewarding for performing actions inside the app.

Try in the app

Next steps

Give us your feedback! Was this article helpful?

😀 🙁