Track and react to user behavior with easy-to-integrate recommended events for gaming apps
Below, you'll find a bunch of in-app events recommended for your app category. We based our choice on industry-specific best practices and experts' advice. By tracking these selected events, you can improve your behavioral segmentation and perform more effective, user-centric messaging campaigns.
To implement any of these or other events:
create the Event in your Pushwoosh Control Panel, add attributes if needed;
integrate the postEvent method into your mobile project providing the event name and attributes names are exactly the same as in the Control Panel.
// To use with Web Push SDK, you can integrate this code:constPushwoosh=window.Pushwoosh || [];Pushwoosh.push(function(api) {api.postEvent("Event name", { // event name exactly as in Control Panel"attribute 1":"string value",// attribute name and type exactly as in Control Panel"attribute 2":"string value"// attribute name and type exactly as in Control Panel });});
// To use with iOS SDK, you can integrate this code:let attributes: [String:Any] = ["attribute 1":"string value", // attribute name and type exactly as in Control Panel"attribute 2":"string value"// attribute name and type exactly as in Control Panel]PWInAppManager.shared().postEvent("Event name", withAttributes: attributes)// event name exactly as in Control Pane
// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{
@"attribute 1" : @"string value", // attribute name and type exactly as in Control Panel
@"attribute 2" : @"string value" //attribute name and type exactly as in Control Panel
};
[[PushNotificationManager pushManager] postEvent:@“eventName” withAttributes:attributes]; // event name exactly as in Control Panel
// To use with Android SDK, you can integrate this code:TagsBundle attributes =new TagsBundle.Builder().putString("attribute 1","string value") //attribute name and type exactly as in Control Panel.putString("attribute 2","string value") //attribute name and type exactly as in Control Panel.build()PushwooshInApp.getInstance().postEvent("Event name", attributes); // event name exactly as in Control Panel
The samples below can be simply pasted into your app, provided there is a corresponding Event and its attributes are created in your Control Panel. Once integrated, the event data will be collected and become available in Audience -> Events -> Event statistics, and you will be able to use the event in campaign planning.
When a user reaches a new game level, trigger the New level event.
Recommended attributes:
level_id: String
user_id: String
// To use with Web Push SDK, you can integrate this code:constPushwoosh=window.Pushwoosh || [];Pushwoosh.push(function(api) {api.postEvent("New level", {"level_id":"string value","user_id":"string value" });});
// To use with iOS SDK, you can integrate this code:let attributes: [String:Any] = ["level_id":"string value","user_id":"string value"]PWInAppManager.shared().postEvent("New level", withAttributes: attributes)
// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{
@"level_id" : @"string value",
@"user_id" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"New level" withAttributes:attributes];
// To use with Android SDK, you can integrate this code:TagsBundle attributes =new TagsBundle.Builder().putString("level_id","string value").putString("user_id","string value").build()PushwooshInApp.getInstance().postEvent("New level", attributes);
Level completed
Send this event when a user completes a particular game level.
Recommended attributes:
level_id: String
user_id: String
// To use with Web Push SDK, you can integrate this code:constPushwoosh=window.Pushwoosh || [];Pushwoosh.push(function(api) {api.postEvent("Level completed", {"level_id":"string value","user_id":"string value" });});
// To use with iOS SDK, you can integrate this code:let attributes: [String:Any] = ["level_id":"string value","user_id":"string value"]PWInAppManager.shared().postEvent("Level completed", withAttributes: attributes)
// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{
@"level_id" : @"string value",
@"user_id" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Level completed" withAttributes:attributes];
// To use with Android SDK, you can integrate this code:TagsBundle attributes =new TagsBundle.Builder().putString("level_id","string value").putString("user_id","string value").build()PushwooshInApp.getInstance().postEvent("Level completed", attributes);
Virtual currency earned
Fire this event when a user's virtual currency balance tops up.
Recommended attributes:
currency_name: String
quantity: Integer
user_id: String
// To use with Web Push SDK, you can integrate this code:constPushwoosh=window.Pushwoosh || [];Pushwoosh.push(function(api) {api.postEvent("Virtual currency earned", {"currency_name":"string value","quantity":1,"user_id":"string value" });});
// To use with iOS SDK, you can integrate this code:let attributes: [String:Any] = ["currency_name":"string value","quantity":1,"user_id":"string value"]PWInAppManager.shared().postEvent("Virtual currency earned", withAttributes: attributes)
// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{
@"currency_name" : @"string value",
@"quantity" : @(1),
@"user_id" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Virtual currency earned" withAttributes:attributes];
// To use with Android SDK, you can integrate this code:TagsBundle attributes =new TagsBundle.Builder().putString("currency_name","string value").putInt("quantity",1).putString("user_id","string value").build()PushwooshInApp.getInstance().postEvent("Virtual currency earned", attributes);
Tutorial completed
Trigger this event when a user completes the in-game tutorial.
Recommended attributes:
tutorial_name: String
completion: Boolean
// To use with Web Push SDK, you can integrate this code:constPushwoosh=window.Pushwoosh || [];Pushwoosh.push(function(api) {api.postEvent("Tutorial completed", {"tutorial_name":"string value","completion":true });});
// To use with iOS SDK, you can integrate this code:let attributes: [String:Any] = ["tutorial_name":"string value","completion":true]PWInAppManager.shared().postEvent("Tutorial completed", withAttributes: attributes)
// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{
@"tutorial_name" : @"string value",
@"completion" : @YES
};
[[PushNotificationManager pushManager] postEvent:@"Tutorial completed" withAttributes:attributes];
// To use with Android SDK, you can integrate this code:TagsBundle attributes =new TagsBundle.Builder().putString("tutorial_name","string value").putBoolean("completion",true).build()PushwooshInApp.getInstance().postEvent("Tutorial completed", attributes);
Achievement unlocked
Monitor user engagement with the event fired when a user unlocks a specific achievement.
Recommended attributes:
achievement_name: String
level: Integer
user_id: String
// To use with Web Push SDK, you can integrate this code:constPushwoosh=window.Pushwoosh || [];Pushwoosh.push(function(api) {api.postEvent("Achievement unlocked", {"achievemnt_name":"string value","level":5,"user_id":"string value" });});
// To use with iOS SDK, you can integrate this code:let attributes: [String:Any] = ["achievement_name":"string value","level":5,"user_id":"string value"]PWInAppManager.shared().postEvent("Achievement unlocked", withAttributes: attributes)
// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{
@"achievement_name" : @"string value",
@"level" : @1,
@"user_id" : "string value"
};
[[PushNotificationManager pushManager] postEvent:@"Achievement unlocked" withAttributes:attributes];
// To use with Android SDK, you can integrate this code:TagsBundle attributes =new TagsBundle.Builder().putString("achievemnt_name","string value").putString("level",1).putString("user_id","string value) .build()PushwooshInApp.getInstance().postEvent("Achievement unlocked", attributes);