Track and react to user behavior with easy-to-integrate recommended events for media 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.
Send this event when a user searches for any content in your app.
Recommended attributes:
search_query: String
category: String
// To use with Web Push SDK, you can integrate this code:constPushwoosh=window.Pushwoosh || [];Pushwoosh.push(function(api) {api.postEvent("Search", {"search_query":"string value","category":"string value" });});
// To use with iOS SDK, you can integrate this code:let attributes: [String:Any] = ["search_query":"string value","category":"string value"]PWInAppManager.shared().postEvent("Search", withAttributes: attributes)
// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{
@"search_query" : @"string value",
@"category" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Search" withAttributes:attributes];
// To use with Android SDK, you can integrate this code:TagsBundle attributes =new TagsBundle.Builder().putString("search_query","string value").putString("category","string value").build()PushwooshInApp.getInstance().postEvent("Search", attributes);
Content read
Trigger this event when a user has read a specific piece of content.
Recommended attributes:
category: String
article_id: String
author: String
published_date: Date
// To use with Web Push SDK, you can integrate this code:constPushwoosh=window.Pushwoosh || [];Pushwoosh.push(function(api) {api.postEvent("Content read", {"category":"string value","article_id":"string value","author":"string value","published_date":"new Date()" });});
// To use with iOS SDK, you can integrate this code:let attributes: [String:Any] = ["category":"string value","article_id":"string value","author":"string value","published_date":NSDate()]PWInAppManager.shared().postEvent("Content read", withAttributes: attributes)
// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{
@"category" : @"string value",
@"article_id" : @"string value",
@"author" : @"string value",
@"published_date" : [NSDate date]
};
[[PushNotificationManager pushManager] postEvent:@"Content read" withAttributes:attributes];
// To use with Android SDK, you can integrate this code:TagsBundle attributes =new TagsBundle.Builder().putString("category","string value").putString("article_id","string value").putString("author","string value").putDate("published_date",newDate()).build()PushwooshInApp.getInstance().postEvent("Content read", attributes);
Form submission
Track submissions of your in-app forms (for example, Net Promoter Score), the choice of content preferences, and other surveys.
Recommended attributes:
form_name: String
url: String
// To use with Web Push SDK, you can integrate this code:constPushwoosh=window.Pushwoosh || [];Pushwoosh.push(function(api) {api.postEvent("Form submission", {"form_name":"string value","url":"string value" });});
// To use with iOS SDK, you can integrate this code:let attributes: [String:Any] = ["form_name":"string value","url":"string value"]PWInAppManager.shared().postEvent("Form submission", withAttributes: attributes)
// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{
@"form_name" : @"string value",
@"url" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Form submission" withAttributes:attributes];
// To use with Android SDK, you can integrate this code:TagsBundle attributes =new TagsBundle.Builder().putString("form_name","string value").putString("url","string value").build()PushwooshInApp.getInstance().postEvent("Form submission", attributes);
Content shared
Trigger this event when a user has shared a piece of content via social networks, email or other channels.
Recommended attributes:
category: String
article_id: String
author: String
published_date: Date
button_id: String
social_media: String
// To use with Web Push SDK, you can integrate this code:constPushwoosh=window.Pushwoosh || [];Pushwoosh.push(function(api) {api.postEvent("Content shared", {"category":"string value","article_id":"string value","author":"string value","published_date":"new Date()","button_id":"string value","social_media":"string value" });});
// To use with iOS SDK, you can integrate this code:let attributes: [String:Any] = ["category":"string value","article_id":"string value","author":"string value","published_date":NSDate(),"button_id":"string value","social_media":"string value"]PWInAppManager.shared().postEvent("Content shared", withAttributes: attributes)
// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{
@"category" : @"string value",
@"article_id" : @"string value",
@"author" : @"string value",
@"published_date" : [NSDate date],
@"button_id" : @"string value",
@"social_media" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Content shared" withAttributes:attributes];
// To use with Android SDK, you can integrate this code:TagsBundle attributes =new TagsBundle.Builder().putString("category","string value").putString("article_id","string value").putString("author","string value").putDate("published_date",newDate()).putString("button_id","string value").putString("social_media","string value").build()PushwooshInApp.getInstance().postEvent("Content shared", attributes);
Content preferences
Fire this event when a user chooses a specific topic they are interested in.
Recommended attributes:
topic: String
// To use with Web Push SDK, you can integrate this code:constPushwoosh=window.Pushwoosh || [];Pushwoosh.push(function(api) {api.postEvent("Content preferences", {"topic":"string value" });});
// To use with iOS SDK, you can integrate this code:let attributes: [String:Any] = ["topic":"string value"]PWInAppManager.shared().postEvent("Content preferences", withAttributes: attributes)
// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{
@"topic" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Content preferences" withAttributes:attributes];
// To use with Android SDK, you can integrate this code:TagsBundle attributes =new TagsBundle.Builder().putString("topic","string value").build()PushwooshInApp.getInstance().postEvent("Content preferences", attributes);