Custom events examples for e-commerce
此内容尚未提供您的语言版本。
Suggested events for e-commerce, 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.
Product viewed
Anchor link toFire this event when a user opens a product page. Use it for browse abandonment campaigns and to segment users by the products and categories they view.
Recommended attributes:
- product_id: String
- product_category: String
- price: decimal (price)
- source: String
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("Product viewed", { "product_id": "string value", "product_category": "string value", "price": 49.99, "source": "string value" });});// To use with iOS SDK, you can integrate this code:
let attributes: [String : Any] = [ "product_id" : "string value", "product_category" : "string value", "price" : 49.99, "source" : "string value"]Pushwoosh.configure.postEvent("Product viewed", withAttributes: attributes)// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{ @"product_id" : @"string value", @"product_category" : @"string value", @"price" : @(49.99), @"source" : @"string value"};[[Pushwoosh configure] postEvent:@"Product viewed" withAttributes:attributes];// To use with Android SDK, you can integrate this code:
TagsBundle attributes = new TagsBundle.Builder() .putString("product_id", "string value") .putString("product_category", "string value") .putAll(new JSONObject(Collections.singletonMap("price", 49.99))) // TagsBundle has no decimal setter .putString("source", "string value") .build();
InAppManager.getInstance().postEvent("Product viewed", attributes);Product added to cart
Anchor link toFire this event once a user adds product to their cart to build Abandoned Cart campaigns, set user tags, or analyze the efficiency of your promotions.
Recommended attributes:
- product_id: String
- price: decimal (price)
- source: String
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("Product added to cart", { "product_id": "string value", "price": 49.99, "source": "string value" });});// To use with iOS SDK, you can integrate this code:
let attributes: [String : Any] = [ "price" : 49.99, "product_id" : "string value", "source" : "string value"]Pushwoosh.configure.postEvent("Product added to cart", withAttributes: attributes)// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{ @"price" : @(49.99), @"product_id" : @"string value", @"source" : @"string value"};[[Pushwoosh configure] postEvent:@"Product added to cart" withAttributes:attributes];// To use with Android SDK, you can integrate this code:
TagsBundle attributes = new TagsBundle.Builder() .putAll(new JSONObject(Collections.singletonMap("price", 49.99))) // TagsBundle has no decimal setter .putString("product_id", "string value") .putString("source", "string value") .build();
InAppManager.getInstance().postEvent("Product added to cart", attributes);Checkout started
Anchor link toFire this event when a user starts checkout. A user who started checkout but didn’t place an order is the audience for a checkout reminder.
Recommended attributes:
- cart_id: String
- cart_total: decimal (price)
- currency: String
- items_count: Integer
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("Checkout started", { "cart_id": "string value", "cart_total": 49.99, "currency": "USD", "items_count": 2 });});// To use with iOS SDK, you can integrate this code:
let attributes: [String : Any] = [ "cart_id" : "string value", "cart_total" : 49.99, "currency" : "USD", "items_count" : 2]Pushwoosh.configure.postEvent("Checkout started", withAttributes: attributes)// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{ @"cart_id" : @"string value", @"cart_total" : @(49.99), @"currency" : @"USD", @"items_count" : @2};[[Pushwoosh configure] postEvent:@"Checkout started" withAttributes:attributes];// To use with Android SDK, you can integrate this code:
TagsBundle attributes = new TagsBundle.Builder() .putString("cart_id", "string value") .putAll(new JSONObject(Collections.singletonMap("cart_total", 49.99))) // TagsBundle has no decimal setter .putString("currency", "USD") .putInt("items_count", 2) .build();
InAppManager.getInstance().postEvent("Checkout started", attributes);Order placed
Anchor link toFire this event when a user completes a purchase. Send it for every purchase as your main purchase event, together with Discounted purchase, Product category, or First purchase when they also apply.
Recommended attributes:
- order_id: String
- __amount: decimal (price)
- __currency: String, a currency code such as
USD - product_id: String
- coupon_id: String
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("Order placed", { "order_id": "string value", "__amount": 49.99, "__currency": "USD", "product_id": "string value", "coupon_id": "string value" });});// To use with iOS SDK, you can integrate this code:
let attributes: [String : Any] = [ "order_id" : "string value", "__amount" : 49.99, "__currency" : "USD", "product_id" : "string value", "coupon_id" : "string value"]Pushwoosh.configure.postEvent("Order placed", withAttributes: attributes)// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{ @"order_id" : @"string value", @"__amount" : @(49.99), @"__currency" : @"USD", @"product_id" : @"string value", @"coupon_id" : @"string value"};[[Pushwoosh configure] postEvent:@"Order placed" withAttributes:attributes];// To use with Android SDK, you can integrate this code:
TagsBundle attributes = new TagsBundle.Builder() .putString("order_id", "string value") .putAll(new JSONObject(Collections.singletonMap("__amount", 49.99))) // TagsBundle has no decimal setter .putString("__currency", "USD") .putString("product_id", "string value") .putString("coupon_id", "string value") .build();
InAppManager.getInstance().postEvent("Order placed", attributes);With the __amount and __currency attributes, Pushwoosh starts tracking revenue for this event automatically the first time it arrives. See Conversion events.
Order refunded
Anchor link toFire this event when an order is refunded, fully or partially. Use it to exclude these users from post-purchase campaigns or to ask why they returned the order.
Recommended attributes:
- order_id: String
- refund_amount: decimal (price)
- currency: String
- reason: String
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("Order refunded", { "order_id": "string value", "refund_amount": 49.99, "currency": "USD", "reason": "string value" });});// To use with iOS SDK, you can integrate this code:
let attributes: [String : Any] = [ "order_id" : "string value", "refund_amount" : 49.99, "currency" : "USD", "reason" : "string value"]Pushwoosh.configure.postEvent("Order refunded", withAttributes: attributes)// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{ @"order_id" : @"string value", @"refund_amount" : @(49.99), @"currency" : @"USD", @"reason" : @"string value"};[[Pushwoosh configure] postEvent:@"Order refunded" withAttributes:attributes];// To use with Android SDK, you can integrate this code:
TagsBundle attributes = new TagsBundle.Builder() .putString("order_id", "string value") .putAll(new JSONObject(Collections.singletonMap("refund_amount", 49.99))) // TagsBundle has no decimal setter .putString("currency", "USD") .putString("reason", "string value") .build();
InAppManager.getInstance().postEvent("Order refunded", attributes);Discounted purchase
Anchor link toTrigger this event once a user purchases any product using a discount coupon.
Recommended attributes:
- product_id: String
- coupon_id: String
- price: decimal (price)
- discount: String
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("Discounted purchase", { "product_id": "string value", "coupon_id": "string value", "price": 49.99, "discount": "string value" });});// To use with iOS SDK, you can integrate this code:
let attributes: [String : Any] = [ "product_id" : "string value", "coupon_id" : "string value", "price" : 49.99, "discount" : "string value"]Pushwoosh.configure.postEvent("Discounted purchase", withAttributes: attributes)// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{ @"product_id" : @"string value", @"coupon_id" : @"string value", @"price" : @(49.99), @"discount" : @"string value"};[[Pushwoosh configure] postEvent:@"Discounted purchase" withAttributes:attributes];// To use with Android SDK, you can integrate this code:
TagsBundle attributes = new TagsBundle.Builder() .putString("product_id", "string value") .putString("coupon_id", "string value") .putAll(new JSONObject(Collections.singletonMap("price", 49.99))) // TagsBundle has no decimal setter .putString("discount", "string value") .build();
InAppManager.getInstance().postEvent("Discounted purchase", attributes);Product page abandoned
Anchor link toFire this event when a user leaves a product page without a conversion action.
Recommended attributes:
- product_id: String
- price: decimal (price)
- source: String
- product_page_id: String
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("Product Page abandoned", { "product_id": "string value", "price": 49.99, "source": "string value", "product_page_id": "string value" });});// To use with iOS SDK, you can integrate this code:
let attributes: [String : Any] = [ "product_id" : "string value", "price" : 49.99, "source" : "string value", "product_page_id" : "string value"]Pushwoosh.configure.postEvent("Product Page abandoned", withAttributes: attributes)// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{ @"product_id" : @"string value", @"price" : @(49.99), @"source" : @"string value", @"product_page_id" : @"string value"};[[Pushwoosh configure] postEvent:@"Product Page abandoned" withAttributes:attributes];// To use with Android SDK, you can integrate this code:
TagsBundle attributes = new TagsBundle.Builder() .putString("product_id", "string value") .putAll(new JSONObject(Collections.singletonMap("price", 49.99))) // TagsBundle has no decimal setter .putString("source", "string value") .putString("product_page_id", "string value") .build();
InAppManager.getInstance().postEvent("Product Page abandoned", attributes);Product added to wishlist
Anchor link toStay informed of the products that users have saved to their wishlists and create personal offers and promo campaigns.
Recommended attributes:
- product_id: String
- wishlist_id: String
- product_price: decimal (price)
- source: String
- user_id: String
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("Product added to wishlist", { "product_id": "string value", "wishlist_id": "string value", "product_price": 49.99, "source": "string value", "user_id": "string value" });});// To use with iOS SDK, you can integrate this code:
let attributes: [String : Any] = [ "product_id" : "string value", "wishlist_id" : "string value", "product_price" : 49.99, "source" : "string value", "user_id" : "string value"]Pushwoosh.configure.postEvent("Product added to wishlist", withAttributes: attributes)// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{ @"product_id" : @"string value", @"wishlist_id" : @"string value", @"product_price" : @(49.99), @"source" : @"string value", @"user_id" : @"string value"};[[Pushwoosh configure] postEvent:@"Product added to wishlist" withAttributes:attributes];// To use with Android SDK, you can integrate this code:
TagsBundle attributes = new TagsBundle.Builder() .putString("product_id", "string value") .putString("wishlist_id", "string value") .putAll(new JSONObject(Collections.singletonMap("product_price", 49.99))) // TagsBundle has no decimal setter .putString("source", "string value") .putString("user_id", "string value") .build();
InAppManager.getInstance().postEvent("Product added to wishlist", attributes);Product removed from wishlist
Anchor link toFire this event when a user deletes a product from their wishlist.
Recommended attributes:
- user_id: String
- wishlist_id: String
- product_id: String
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("Product removed from wishlist", { "wishlist_id": "string value", "user_id": "string value", "product_id": "string value" });});// To use with iOS SDK, you can integrate this code:
let attributes: [String : Any] = [ "wishlist_id" : "string value", "user_id" : "string value", "product_id" : "string value"]Pushwoosh.configure.postEvent("Product removed from wishlist", withAttributes: attributes)// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{ @"wishlist_id" : @"string value", @"user_id" : @"string value", @"product_id" : @"string value"};[[Pushwoosh configure] postEvent:@"Product removed from wishlist" withAttributes:attributes];// To use with Android SDK, you can integrate this code:
TagsBundle attributes = new TagsBundle.Builder() .putString("wishlist_id", "string value") .putString("user_id", "string value") .putString("product_id", "string value") .build();
InAppManager.getInstance().postEvent("Product removed from wishlist", attributes);Product category
Anchor link toSend this event when a user purchases a product of a specific category.
Recommended attributes:
- product_id: String
- product_category: String
- currency: String
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("Product category", { "product_id": "string value", "product_category": "string value", "currency": "string value" });});// To use with iOS SDK, you can integrate this code:
let attributes: [String : Any] = [ "product_id" : "string value", "product_category" : "string value", "currency" : "string value"]Pushwoosh.configure.postEvent("Product category", withAttributes: attributes)// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{ @"product_id" : @"string value", @"product_category" : @"string value", @"currency" : @"string value"};[[Pushwoosh configure] postEvent:@"Product category" withAttributes:attributes];// To use with Android SDK, you can integrate this code:
TagsBundle attributes = new TagsBundle.Builder() .putString("product_id", "string value") .putString("product_category", "string value") .putString("currency", "string value") .build();
InAppManager.getInstance().postEvent("Product category", attributes);First purchase
Anchor link toTrigger this event once a user makes their first purchase.
Recommended attributes:
- product_id: String,
- category: String
- date: Date
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];Pushwoosh.push(function(api) { api.postEvent("First purchase", { "product_id": "string value", "category": "string value", "date": new Date() });});// To use with iOS SDK, you can integrate this code:
let attributes: [String : Any] = [ "product_id" : "string value", "category" : "string value", "date" : NSDate()]Pushwoosh.configure.postEvent("First purchase", withAttributes: attributes)// To use with iOS SDK, you can integrate this code:
NSDictionary *attributes = @{ @"product_id" : @"string value", @"category" : @"string value", @"date" : [NSDate date]};[[Pushwoosh configure] postEvent:@"First purchase" withAttributes:attributes];// To use with Android SDK, you can integrate this code:
TagsBundle attributes = new TagsBundle.Builder() .putString("product_id", "string value") .putString("category", "string value") .putDate("date", new Date()) .build();
InAppManager.getInstance().postEvent("First purchase", attributes);