Use case: verified rewarding for inviting friends to the app¶
Overview¶
Rewarding users for inviting friends is a great way to boost your user base grow, but basics rewarding for the install is prone to fraud. Users who want to take advantage of it, may reinstall application multiple times or reset device IDs.
Smart Flows enable you to delay rewarding of the user to the moment when an invited friend will reach a certain level or perform the desired action in the application. This way you will reward users not for installs but for actual use of the application.
Implementation Guide¶
In our example, we will implement a Smart Flow to reward the user when friends that they invited to the application reach Level 5.
0. Prerequisite¶
-
Integrate GetSocial SDK. Check the detailed guide on Android, iOS or Unity.
-
Setup push notifications. Check the detailed setup guide on Android, iOS or Unity.
-
Allow inviting friends to the app. Integrate Smart Invites to provide User A a way to invite his friends. See the detailed guide for the SDK.
-
Make sure the app can handle notifications with actions to process such actions. Check the detailed implementation guide.
1. Add analytics event in the app¶
To start a Smart Flow, you have to let GetSocial know when the user upgrades to the next level on the client side. We make event names generic and provide details like a level in the event properties. This way you’ll be able to set up more flexible Smart Flow rules.
To let GetSocial know about the level upgrade, track an analytics event:
Map<String, String> properties = new HashMap<>();
properties.put("level", "5");
GetSocial.trackCustomEvent("level_achieved", properties);
GetSocial.trackCustomEvent("level_achieved", mapOf("level" to "5"))
[GetSocial trackCustomEventWithName:@"level_achieved" eventProperties:@{@"level": @"5"}];
GetSocial.trackCustomEvent(withName: "level_achieved", eventProperties: [ "level": "5" ])
var properties = new Dictionary<string, string>
{
{"level", "5"}
};
GetSocial.TrackCustomEvent("level_achieved", properties);
2. Select event-based flow¶
When all prerequisites are satisfied we’re ready to create a Smart Flow to automate user rewards.
- Login to GetSocial Dashboard and go to Smart Flows section → Create new flow.
- Choose an Event Based flow. For event-based flows we have to specify the event that will start the flow and, optionally, add event property filters.
- Set flow name to “Reward for inviting friends on level 5”.
-
In the Event enter the event name from the previous step
level_achieved
→ set the start condition to for the 1st time → add a new property filter by clicking Add filter → enter property namelevel
with condition is 5 → click Define actions.
3. Define actions¶
The next step is to define what actions should be performed when the flow is triggered.
- In the Add action section select Send notification from the dropdown.
-
To set the notification text and action that should be performed we have to create a new notification template or use one of the existing ones.
To create a new notification template click Select a template → scroll to Create a new template → set template name → click Step 2 - Content button → provide notification title, text and localizations for the languages your app supports → click Step 3 - Action → select Custom action.
Add the promo details as an Action Data. In this case, we have to add two key-value pairs
type: soft_currency_reward
andamount: 100
.Make sure app can handle custom notification actions
Before using custom actions, make sure you implemented custom action handling in the app. Check the full guide to do it.
-
Select who will receive the notification. With Smart Flows you can send the notification to the user itself, his referrer from Smart Invites or all user’s friends.
In this case, we’ll send a notification to the User’s Referrer.
-
Click Add Action button → review your new action -> click Add Action button again
-
In the Add action section select Send Webhook from the dropdown.
In this case set
verified_invite
as Name for the webhook and any Custom Data you would like us to include in the request to your servers. -
To finish the flow setup click Add Action button → review your flow → click Create Flow button.