# 自定义事件示例

下面，您将找到针对不同应用类别推荐的一系列应用内事件。

要实现这些或任何其他事件：

* 在您的 Pushwoosh 控制面板中[创建一个事件](/zh/product/audience-data-and-segmentation/events/#1-create-events-in-pushwoosh-control-panel)，并根据需要添加属性；
* 将 [postEvent](/zh/developer/api-reference/user-centric-api#postevent) 方法集成到您的移动项目中，提供与控制面板中完全相同的事件名称及其属性。

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = 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
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// 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 Panel
```
</TabItem>
<TabItem label="Objective-C">
```objective-c
// 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
```
</TabItem>

<TabItem label="Java">
```java
// 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
```
</TabItem>
</Tabs>

<Aside type="note">
只要在您的控制面板中创建了相应的事件及其属性，下面的示例就可以直接粘贴到您的应用中。集成后，事件数据将被收集并显示在 Audience -> Events -> Event statistics 中，您将能够在营销活动规划中使用该事件。
</Aside>

## 移动应用

### 登出

当用户在您的应用中登出其账户时触发此事件。

推荐属性：

* user_id: String
* date: Date

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("Log out", {
    "user_id": "string value",
    "date": "date value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "user_id" : "string value",
   "date" : "date value"
]
PWInAppManager.shared().postEvent("Log out", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"user_id" : @"string value",
   @"date" : @"date value"
};
[[PushNotificationManager pushManager] postEvent:@"Log out" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// To use with Android SDK, you can integrate this code:

TagsBundle attributes = new TagsBundle.Builder()
    .putString("user_id", "string value")
    .putString("date", "date value")
    .build()

PushwooshInApp.getInstance().postEvent("Log out", attributes);
```
</TabItem>
</Tabs>

### 已添加支付方式

当用户在其应用账户中添加支付方式时触发此事件，例如提供银行卡凭证或将账户链接到支付系统。

推荐属性：

* payment_method: String,
* user_id: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("Payment method added", {
    "user_id": "string value",
    "payment_method": "string value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "user_id" : "string value",
   "payment_method" : "string value"
]
PWInAppManager.shared().postEvent("Payment method added", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"payment_method" : @"string value",
   @"user_id" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Payment method added" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// To use with Android SDK, you can integrate this code:

TagsBundle attributes = new TagsBundle.Builder()
    .putString("payment_method", "string value")
    .putString("user_id", "string value")
    .build()

PushwooshInApp.getInstance().postEvent("Payment method added", attributes);
```
</TabItem>
</Tabs>

### 已更改支付方式

当用户在应用中更新其支付方式时发送此事件。

推荐属性：

* user_id: String,
* payment_method: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("Payment method changed", {
    "user_id": "string value",
    "payment_method": "string value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "user_id" : "string value",
   "payment_method" : "string value"
]
PWInAppManager.shared().postEvent("Payment method changed", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"user_id" : @"string value",
   @"payment_method" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Payment method changed" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// To use with Android SDK, you can integrate this code:

TagsBundle attributes = new TagsBundle.Builder()
    .putString("user_id", "string value")
    .putString("payment_method", "string value")
    .build()

PushwooshInApp.getInstance().postEvent("Payment method changed", attributes);
```
</TabItem>
</Tabs>

### 按钮已点击

通过此事件跟踪应用内的按钮点击，以改进您的分析、测试各种通信策略，并根据客户行为提高消息的相关性。

推荐事件属性：

* user_id: String
* button_link: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("Button clicked", {
    "user_id": "string value",
    "button_link": "string value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "user_id" : "string value",
   "button_link" : "string value"
]
PWInAppManager.shared().postEvent("Button clicked", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"user_id" : @"string value",
   @"button_link" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Button clicked" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// To use with Android SDK, you can integrate this code:

TagsBundle attributes = new TagsBundle.Builder()
    .putString("user_id", "string value")
    .putString("button_link", "string value")
    .build()

PushwooshInApp.getInstance().postEvent("Button clicked", attributes);

```
</TabItem>
</Tabs>

### 应用已更新

每当用户安装您应用的更新版本时触发此事件。

推荐属性：

* previous_app_version: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("Application updated", {
    "previous_app_version": "string value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "previous_app_version" : "string value"
]
PWInAppManager.shared().postEvent("Application updated", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"previous_app_version" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Application updated" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// To use with Android SDK, you can integrate this code:

TagsBundle attributes = new TagsBundle.Builder()
    .putString("previous_app_version", "string value")
    .build()

PushwooshInApp.getInstance().postEvent("Application updated", attributes);
```
</TabItem>
</Tabs>

### 操作系统已更新

当用户更新其设备的操作系统版本以确保您的应用完全兼容时触发此事件。

推荐属性：

* previous_OS_version: String
* new_OS_version: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("OS updated", {
    "previous_OS_version": "string value",
    "new_OS_version": "string value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "previous_OS_version" : "string value",
   "new_OS_version": "string value"
]
PWInAppManager.shared().postEvent("OS updated", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"previous_OS_version" : @"string value",
   @"new_OS_version" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"OS updated" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// To use with Android SDK, you can integrate this code:

TagsBundle attributes = new TagsBundle.Builder()
    .putString("previous_OS_version", "string value")
    .putString("new_OS_version", "string value")
    .build()

PushwooshInApp.getInstance().postEvent("OS updated", attributes);
```
</TabItem>
</Tabs>

## 电子商务
### 商品已添加到购物车

一旦用户将商品添加到购物车，就触发此事件，以构建“废弃购物车”营销活动、设置用户标签或分析促销活动的效率。

推荐属性：

* product_id: String
* price: Integer
* source: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// 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": 1,
    "source": "string value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "price" : 1,
   "product_id" : "string value",
   "source" : "string value"
]
PWInAppManager.shared().postEvent("Product added to cart", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"price" : @(1),
   @"product_id" : @"string value",
   @"source" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Product added to cart" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// To use with Android SDK, you can integrate this code:

TagsBundle attributes = new TagsBundle.Builder()
    .putInt("price", 1)
    .putString("product_id", "string value")
    .putString("source", "string value")
    .build()

PushwooshInApp.getInstance().postEvent("Product added to cart", attributes);
```
</TabItem>
</Tabs>

### 折扣购买

一旦用户使用折扣券购买任何产品，就触发此事件。

推荐属性：

* product_id: String
* coupon_id: String
* price: Integer
* discount: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// 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": 1,
    "discount": "string value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "product_id" : "string value",
   "coupon_id" : "string value",
   "price" : 1,
   "discount" : "string value"
]
PWInAppManager.shared().postEvent("Discounted purchase", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"product_id" : @"string value",
   @"coupon_id" : @"string value",
   @"price" : @(1),
   @"discount" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Discounted purchase" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// 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")
    .putInt("price", 1)
    .putString("discount", "string value")
    .build()

PushwooshInApp.getInstance().postEvent("Discounted purchase", attributes);
```
</TabItem>
</Tabs>

### 商品页面已放弃

当用户离开商品页面而未进行转化操作时触发此事件。

推荐属性：

* product_id: String
* price: Integer
* source: String
* product_page_id: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// 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": 1,
    "source": "string value",
    "product_page_id": "string value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "product_id" : "string value",
   "price" : 1,
   "source" : "string value",
   "product_page_id" : "string value"
]
PWInAppManager.shared().postEvent("Product Page abandoned", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"product_id" : @"string value",
   @"price" : @(1),
   @"source" : @"string value",
   @"product_page_id" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Product Page abandoned" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// To use with Android SDK, you can integrate this code:

TagsBundle attributes = new TagsBundle.Builder()
    .putString("product_id", "string value")
    .putInt("price", 1)
    .putString("source", "string value")
    .putString("product_page_id", "string value")
    .build()

PushwooshInApp.getInstance().postEvent("Product Page abandoned", attributes);
```
</TabItem>
</Tabs>

### 商品已添加到心愿单

随时了解用户保存到心愿单的商品，并创建个性化优惠和促销活动。

推荐属性：

* product_id: String
* wishlist_id: String
* product_price: Integer
* source: String
* user_id: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// 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",
    "currency": "string value",
    "price": 1,
    "source": "string value",
    "user_id": "string value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "product_id" : "string value",
   "wishlist_id" : "string value",
   "product_price" : 1,
   "source" : "string value",
   "user_id" : "string value"
]
PWInAppManager.shared().postEvent("Product added to wishlist", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"product_id" : @"string value",
   @"wishlist_id" : @"string value",
   @"product_price" : @(1),
   @"source" : @"string value",
   @"user_id" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Product added to wishlist" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// 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")
    .putInt("product_price", 1)
    .putString("source", "string value")
    .putString("user_id", "string value")
    .build()

PushwooshInApp.getInstance().postEvent("Product added to wishlist", attributes);
```
</TabItem>
</Tabs>

### 商品已从心愿单移除

当用户从心愿单中删除商品时触发此事件。

推荐属性：

* user_id: String
* wishlist_id: String
* product_id: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// 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"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// 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"
]
PWInAppManager.shared().postEvent("Product removed from wishlist", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"wishlist_id" : @"string value",
   @"user_id" : @"string value",
   @"product_id" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Product removed from wishlist" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// 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()

PushwooshInApp.getInstance().postEvent("Product removed from wishlist", attributes);
```
</TabItem>
</Tabs>

### 商品类别

当用户购买特定类别的商品时发送此事件。

推荐属性：

* product_id: String
* product_category: String
* currency: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// 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"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// 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"
]
PWInAppManager.shared().postEvent("Product category", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"product_id" : @"string value",
   @"product_category" : @"string value",
   @"currency" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Product category" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// 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()

PushwooshInApp.getInstance().postEvent("Product category", attributes);
```
</TabItem>
</Tabs>

### 首次购买

一旦用户进行首次购买，就触发此事件。

推荐属性：

* product_id: String,
* category: String
* date: Date

<Tabs>
<TabItem label="JavaScript">
```javascript
// 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": "date value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "product_id" : "string value",
   "category" : "string value",
   "date" : "date value"
]
PWInAppManager.shared().postEvent("First purchase", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"product_id" : @"string value",
   @"category" : @"string value",
   @"date" : @"date value"
};
[[PushNotificationManager pushManager] postEvent:@"First purchase" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// To use with Android SDK, you can integrate this code:

TagsBundle attributes = new TagsBundle.Builder()
    .putString("product_id", "string value")
    .putString("category", "string value")
    .putBoolean("date", "date value")
    .build()

PushwooshInApp.getInstance().postEvent("First purchase", attributes);
```
</TabItem>
</Tabs>

## 游戏应用

### 新关卡

当用户达到新的游戏关卡时，触发“新关卡”事件。

推荐属性：

* level_id: String
* user_id: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("New level", {
    "level_id": "string value",
    "user_id": "string value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// 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)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// 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];
```
</TabItem>

<TabItem label="Java">
```java
// 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);
```
</TabItem>
</Tabs>

### 关卡已完成

当用户完成特定游戏关卡时发送此事件。

推荐属性：

* level_id: String
* user_id: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("Level completed", {
    "level_id": "string value",
    "user_id": "string value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// 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)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// 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];
```
</TabItem>

<TabItem label="Java">
```java
// 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);
```
</TabItem>
</Tabs>

### 获得虚拟货币

当用户的虚拟货币余额增加时触发此事件。

推荐属性：

* currency_name: String
* quantity: Integer
* user_id: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("Virtual currency earned", {
    "currency_name": "string value",
    "quantity": 1,
    "user_id": "string value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// 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)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// 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];
```
</TabItem>

<TabItem label="Java">
```java
// 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);
```
</TabItem>
</Tabs>

### 教程已完成

当用户完成游戏内教程时触发此事件。

推荐属性：

* tutorial_name: String
* completion: Boolean

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("Tutorial completed", {
    "tutorial_name": "string value",
    "completion": true
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// 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)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// 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];
```
</TabItem>

<TabItem label="Java">
```java
// 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);
```
</TabItem>
</Tabs>

### 成就已解锁

通过用户解锁特定成就时触发的事件来监控用户参与度。

推荐属性：

* achievement_name: String
* level: Integer
* user_id: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("Achievement unlocked", {
    "achievement_name": "string value",
    "level": 5,
    "user_id": "string value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// 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)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// 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];
```
</TabItem>

<TabItem label="Java">
```java
// 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);
```
</TabItem>
</Tabs>

## 订阅管理


### 付费订阅购买

当用户购买了付费订阅计划时发送此事件。

推荐属性：

* subscription_plan_name: String
* price: Integer
* currency:String
* expiry_date:Date

<Tabs>
<TabItem label="JavaScript">
```javascript
// 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": 1,
    "currency": "string value",
    "expiry_date": "new Date()"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "subscription_plan_name" : "string value",
   "price" : 1,
   "currency" : "string value",
   "expiry_date" : NSDate()
]
PWInAppManager.shared().postEvent("Paid subscription purchase", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"subscription_plan_name" : @"string value",
   @"price" : @(1),
   @"currency" : @"string value",
   @"expiry_date" : [NSDate date]
};
[[PushNotificationManager pushManager] postEvent:@"Paid subscription purchase" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// To use with Android SDK, you can integrate this code:

TagsBundle attributes = new TagsBundle.Builder()
    .putString("subscription_plan_name", "string value")
    .putInt("price", 1)
    .putString("currency", "string value")
    .putDate("expiry_date", new Date())
    .build()

PushwooshInApp.getInstance().postEvent("Paid subscription purchase", attributes);
```
</TabItem>
</Tabs>

### 订阅续订

一旦用户续订其订阅计划，就触发此事件。

推荐属性：

* subscription_plan_name: String
* price: Integer
* currency: String
* renewal_count: Integer

<Tabs>
<TabItem label="JavaScript">
```javascript
// 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": 1,
    "currency": "string value",
    "renewal_count": 1
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "subscription_plan_name" : "string value",
   "price" : 1,
   "currency" : "string value",
   "renewal_count" : 1
]
PWInAppManager.shared().postEvent("Subscription renewal", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"subscription_plan_name" : @"string value",
   @"price" : @(1),
   @"currency" : @"string value",
   @"renewal_count" : @(1)
};
[[PushNotificationManager pushManager] postEvent:@"Subscription renewal" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// To use with Android SDK, you can integrate this code:

TagsBundle attributes = new TagsBundle.Builder()
    .putString("subscription_plan_name", "string value")
    .putInt("price", 1)
    .putString("currency", "string value")
    .putInt("renewal_count", 1)
    .build()

PushwooshInApp.getInstance().postEvent("Subscription renewal", attributes);
```
</TabItem>
</Tabs>

### 免费试用已开始

当用户选择在订阅前开始免费试用时触发此事件。

推荐属性：

* free_trial_name: String
* expiry_date: Date

<Tabs>
<TabItem label="JavaScript">
```javascript
// 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()"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "free_trial_name" : "string value",
   "expiry_date" : NSDate()
]
PWInAppManager.shared().postEvent("Free trial started", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"free_trial_name" : @"string value",
   @"expiry_date" : [NSDate date]
};
[[PushNotificationManager pushManager] postEvent:@"Free trial started" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// 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()

PushwooshInApp.getInstance().postEvent("Free trial started", attributes);
```
</TabItem>
</Tabs>

### 订阅已取消

使用此事件跟踪应用内订阅取消情况。

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("Subscription cancelled");
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

PWInAppManager.shared().postEvent("Subscription cancelled", withAttributes: nil)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

[[PushNotificationManager pushManager] postEvent:@"Subscription canceled" withAttributes:@{}];
```
</TabItem>

<TabItem label="Java">
```java
// To use with Android SDK, you can integrate this code:

PushwooshInApp.getInstance().postEvent("Subscription cancelled");
```
</TabItem>
</Tabs>

### 从免费转换为付费

一旦用户从免费使用您的应用转换为付费订阅计划，就触发此事件。

推荐属性：

* subscription_plan_name: String
* price: Integer
* currency: String
* date: Date

<Tabs>
<TabItem label="JavaScript">
```javascript
// 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": 1,
    "currency": "string value",
    "date": "new Date()"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "plan_name" : "string value",
   "price" : 1,
   "currency" : "string value",
   "date" : NSDate()
]
PWInAppManager.shared().postEvent("Conversion from Free to Paid", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"subscription_plan_name" : @"string value",
   @"price" : @(1),
   @"currency" : @"string value",
   @"date" : [NSDate date]
};
[[PushNotificationManager pushManager] postEvent:@"Conversion from Free to Paid" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// To use with Android SDK, you can integrate this code:

TagsBundle attributes = new TagsBundle.Builder()
    .putString("subscription_plan_name", "string value")
    .putInt("price", 1)
    .putString("currency", "string value")
    .putDate("date", new Date())
    .build()

PushwooshInApp.getInstance().postEvent("Conversion from Free to Paid", attributes);
```
</TabItem>
</Tabs>

## 媒体

### 搜索

当用户在您的应用中搜索任何内容时发送此事件。

推荐属性：

* search_query: String
* category: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("Search", {
        "search_query": "string value",
        "category": "string value"
    });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// 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)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// 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];
```
</TabItem>

<TabItem label="Java">
```java
// 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);
```
</TabItem>
</Tabs>

### 内容已阅读

当用户阅读了特定内容时触发此事件。

推荐属性：

* category: String
* article_id: String
* author: String
* published_date: Date

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("Content read", {
    "category": "string value",
    "article_id": "string value",
    "author": "string value",
    "published_date": "new Date()"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// 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)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// 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];
```
</TabItem>

<TabItem label="Java">
```java
// 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", new Date())
    .build()

PushwooshInApp.getInstance().postEvent("Content read", attributes);
```
</TabItem>
</Tabs>

### 表单提交

跟踪您应用内表单的提交（例如，净推荐值分数）、内容偏好选择以及其他调查。

推荐属性：

* form_name: String
* url: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("Form submission", {
    "form_name": "string value",
    "url": "string value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// 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)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// 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];
```
</TabItem>

<TabItem label="Java">
```java
// 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);
```
</TabItem>
</Tabs>

### 内容已分享

当用户通过社交网络、电子邮件或其他渠道分享内容时触发此事件。

推荐属性：

* category: String
* article_id: String
* author: String
* published_date: Date
* button_id: String
* social_media: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:

const Pushwoosh = 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"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// 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)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// 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];
```
</TabItem>

<TabItem label="Java">
```java
// 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", new Date())
    .putString("button_id", "string value")
    .putString("social_media", "string value")
    .build()

PushwooshInApp.getInstance().postEvent("Content shared", attributes);
```
</TabItem>
</Tabs>

### 内容偏好

当用户选择他们感兴趣的特定主题时触发此事件。

推荐属性：

* topic: String

<Tabs>
<TabItem label="JavaScript">
```javascript
// To use with Web Push SDK, you can integrate this code:
const Pushwoosh = window.Pushwoosh || [];
Pushwoosh.push(function(api) {
    api.postEvent("Content preferences", {
    "topic": "string value"
  });
});
```
</TabItem>

<TabItem label="Swift">
```swift
// To use with iOS SDK, you can integrate this code:

let attributes: [String : Any] = [
   "topic" : "string value"
]
PWInAppManager.shared().postEvent("Content preferences", withAttributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
// To use with iOS SDK, you can integrate this code:

NSDictionary *attributes = @{
   @"topic" : @"string value"
};
[[PushNotificationManager pushManager] postEvent:@"Content preferences" withAttributes:attributes];
```
</TabItem>

<TabItem label="Java">
```java
// 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);
```
</TabItem>
</Tabs>