Custom events examples for subscription management
Suggested events for subscription management, each with recommended attributes and code samples. To send an event from your app, see Send custom events from your app. To use these events in segments and journeys, see industry playbooks.
Paid subscription purchase
Anchor link toSend this event when a user has bought a paid subscription plan.
Recommended attributes:
- subscription_plan_name: String
- price: decimal (price)
- currency:String
- expiry_date:Date
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("Paid subscription purchase", { "subscription_plan_name": "string value", "price": 49.99, "currency": "string value", "expiry_date": new Date() });});// To use with iOS SDK, you can integrate this code:
let attributes: [String : Any] = [ "subscription_plan_name" : "string value", "price" : 49.99, "currency" : "string value", "expiry_date" : NSDate()]Pushwoosh.configure.postEvent("Paid subscription purchase", withAttributes: attributes)// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{ @"subscription_plan_name" : @"string value", @"price" : @(49.99), @"currency" : @"string value", @"expiry_date" : [NSDate date]};[[Pushwoosh configure] postEvent:@"Paid subscription purchase" withAttributes:attributes];// To use with Android SDK, you can integrate this code:
TagsBundle attributes = new TagsBundle.Builder() .putString("subscription_plan_name", "string value") .putAll(new JSONObject(Collections.singletonMap("price", 49.99))) // TagsBundle has no decimal setter .putString("currency", "string value") .putDate("expiry_date", new Date()) .build();
InAppManager.getInstance().postEvent("Paid subscription purchase", attributes);Subscription renewal
Anchor link toTrigger this event once a user renews their subscription plan.
Recommended attributes:
- subscription_plan_name: String
- price: decimal (price)
- currency: String
- renewal_count: Integer
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("Subscription renewal", { "subscription_plan_name": "string value", "price": 49.99, "currency": "string value", "renewal_count": 1 });});// To use with iOS SDK, you can integrate this code:
let attributes: [String : Any] = [ "subscription_plan_name" : "string value", "price" : 49.99, "currency" : "string value", "renewal_count" : 1]Pushwoosh.configure.postEvent("Subscription renewal", withAttributes: attributes)// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{ @"subscription_plan_name" : @"string value", @"price" : @(49.99), @"currency" : @"string value", @"renewal_count" : @(1)};[[Pushwoosh configure] postEvent:@"Subscription renewal" withAttributes:attributes];// To use with Android SDK, you can integrate this code:
TagsBundle attributes = new TagsBundle.Builder() .putString("subscription_plan_name", "string value") .putAll(new JSONObject(Collections.singletonMap("price", 49.99))) // TagsBundle has no decimal setter .putString("currency", "string value") .putInt("renewal_count", 1) .build();
InAppManager.getInstance().postEvent("Subscription renewal", attributes);Free trial started
Anchor link toTrigger this event when a user chooses to start a free trial before getting a subscription.
Recommended attributes:
- free_trial_name: String
- expiry_date: Date
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("Free trial started", { "free_trial_name": "string value", "expiry_date": new Date() });});// To use with iOS SDK, you can integrate this code:
let attributes: [String : Any] = [ "free_trial_name" : "string value", "expiry_date" : NSDate()]Pushwoosh.configure.postEvent("Free trial started", withAttributes: attributes)// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{ @"free_trial_name" : @"string value", @"expiry_date" : [NSDate date]};[[Pushwoosh configure] postEvent:@"Free trial started" withAttributes:attributes];// To use with Android SDK, you can integrate this code:
TagsBundle attributes = new TagsBundle.Builder() .putString("free_trial_name", "string value") .putDate("expiry_date", new Date()) .build();
InAppManager.getInstance().postEvent("Free trial started", attributes);Subscription canceled
Anchor link toUse this event to track in-app subscription cancelations.
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("Subscription canceled", {});});// To use with iOS SDK, you can integrate this code:
Pushwoosh.configure.postEvent("Subscription canceled", withAttributes: nil)// To use with iOS SDK, you can integrate this code:
[[Pushwoosh configure] postEvent:@"Subscription canceled" withAttributes:@{}];// To use with Android SDK, you can integrate this code:
InAppManager.getInstance().postEvent("Subscription canceled");Conversion from Free to Paid
Anchor link toTrigger this event once a user converts from using your app for free to a paid subscription plan.
Recommended attributes:
- subscription_plan_name: String
- price: decimal (price)
- currency: String
- date: Date
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("Conversion from Free to Paid", { "subscription_plan_name": "string value", "price": 49.99, "currency": "string value", "date": new Date() });});// To use with iOS SDK, you can integrate this code:
let attributes: [String : Any] = [ "plan_name" : "string value", "price" : 49.99, "currency" : "string value", "date" : NSDate()]Pushwoosh.configure.postEvent("Conversion from Free to Paid", withAttributes: attributes)// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{ @"subscription_plan_name" : @"string value", @"price" : @(49.99), @"currency" : @"string value", @"date" : [NSDate date]};[[Pushwoosh configure] postEvent:@"Conversion from Free to Paid" withAttributes:attributes];// To use with Android SDK, you can integrate this code:
TagsBundle attributes = new TagsBundle.Builder() .putString("subscription_plan_name", "string value") .putAll(new JSONObject(Collections.singletonMap("price", 49.99))) // TagsBundle has no decimal setter .putString("currency", "string value") .putDate("date", new Date()) .build();
InAppManager.getInstance().postEvent("Conversion from Free to Paid", attributes);