---
metadata:
  - name: generator
    content: Diplodoc Platform v5.70.0
alternate:
  - https://appmetrica.yandex.by/docs/en/sdk/ios/analytics/objectivec/AMAECommerce.md
  - https://appmetrica.yandex.by/docs/ru/sdk/ios/analytics/objectivec/AMAECommerce.md
  - https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/objectivec/AMAECommerce.md
  - href: https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/objectivec/AMAECommerce.md
    type: text/markdown
    title: Markdown version
  - href: https://appmetrica.yandex.by/docs/zh/llms.txt?revision=r22089357
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://appmetrica.yandex.by/docs/zh/llms.txt?revision=r22089357

# AMAECommerce 类

此类的方法会创建一个`AMAECommerce`实例。

对于不同的用户操作，存在相应的电商事件类型。 要创建特定事件类型，请使用适当的 `AMAECommerce` 类方法。

{% note info %}

您可以使用 `AMAECommerce` 实例，通过 [+reportECommerce:onFailure:](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/objectivec/AMAAppMetrica.md#method_reportECommerce__onFailure) 方法（[AMAAppMetrica](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/objectivec/AMAAppMetrica.md) 类）和 [AMAAppMetricaReporting](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/objectivec/AMAAppMetricaReporting.md) 协议来发送。

{% endnote %}

## Instance methods {#instance_summary}

#|
|| +[showScreenEventWithScreen:](#method_showScreenEventWithScreen) | Creates an E-commerce event called `显示屏幕事件`. 使用它来报告页面打开，例如产品列表、搜索页或主页。 ||
|| +[showProductCardEventWithProduct:screen:](#method_showProductCardEventWithProduct__screen) | 创建一个电商事件，称为`ShowProductCardEvent`。 使用它来报告在列表中查看产品详情页。 ||
|| +[showProductDetailsEventWithProduct:referrer:](#method_showProductDetailsEventWithProduct__referrer) | 创建一个电商事件，称为`ShowProductDetailsEvent`。 使用它来报告查看产品页。 ||
|| +[addCartItemEventWithItem:](#method_addCartItemEventWithItem) | 创建一个电商事件，称为`AddCartItemEvent` 使用它来报告将商品添加到购物车。 ||
|| +[removeCartItemEventWithItem:](#method_removeCartItemEventWithItem) | 创建一个电商事件，称为`RemoveCartItemEvent`。 使用它来报告从购物车中移除商品。 ||
|| +[beginCheckoutEventWithOrder:](#method_beginCheckoutEventWithOrder) | 创建一个电商事件，称为`BeginCheckoutEvent`。 使用它来报告开始购买。 ||
|| +[purchaseEventWithOrder:](#method_purchaseEventWithOrder) | 创建一个电商事件，称为`PurchaseEvent`。 使用它来报告已完成的购买。 ||
|#

## Method descriptions {#method_detail}

### +showScreenEventWithScreen: {#method_showScreenEventWithScreen}

```objectivec translate=no
+ (instancetype)showScreenEventWithScreen:(AMAECommerceScreen *)screen
```

Creates an E-commerce event called `显示屏幕事件`. 使用它来报告页面打开，例如产品列表、搜索页或主页。

**参数：**

#|
|| `screen` | 已打开的屏幕。 The [AMAECommerceScreen](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/objectivec/AMAECommerceScreen.md) 类实例。 ||
|#

**返回：**

The `AMAECommerce` 类实例。

### +showProductCardEventWithProduct:screen: {#method_showProductCardEventWithProduct__screen}

```objectivec translate=no
+ (instancetype)showProductCardEventWithProduct:(AMAECommerceProduct *)product
                                         screen:(AMAECommerceScreen *)screen
```

创建一个电商事件，称为`ShowProductCardEvent`。 使用它来报告查看产品详情页（在列表中的其他产品中）。

{% note info %}

在发送事件前，请确保产品详情在屏幕上显示超过 N 秒。

{% endnote %}

**参数：**

#|
|| `产品` | 被展示的产品。 The [AMAECommerceProduct](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/objectivec/AMAECommerceProduct.md) 类实例。 ||
|| `screen` | 显示产品的屏幕。 The [AMAECommerceScreen](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/objectivec/AMAECommerceScreen.md) 类实例。 ||
|#

**返回：**

The `AMAECommerce` 类实例。

### +showProductDetailsEventWithProduct:referrer: {#method_showProductDetailsEventWithProduct__referrer}

```objectivec translate=no
+ (instancetype)showProductDetailsEventWithProduct:(AMAECommerceProduct *)product
                                          referrer:(nullable AMAECommerceReferrer *)referrer
```

创建一个电商事件，称为`ShowProductDetailsEvent`。 使用它来报告产品页面浏览。

**参数：**

#|
|| `产品` | 显示的产品。 The [AMAECommerceProduct](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/objectivec/AMAECommerceProduct.md) 类实例。 ||
|| `referrer` | 关于产品页流量来源的信息。 The [AMAECommerceReferrer](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/objectivec/AMAECommerceReferrer.md) 类实例。 ||
|#

**返回：**

The `AMAECommerce` 类实例。

### +addCartItemEventWithItem: {#method_addCartItemEventWithItem}

```objectivec translate=no
+ (instancetype)addCartItemEventWithItem:(AMAECommerceCartItem *)item
```

创建一个电商事件，称为`AddCartItemEvent` 使用它来报告将商品添加到购物车。

**参数：**

#|
|| `item` | 已添加到购物车的商品。 The [AMAECommerceCartItem](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/objectivec/AMAECommerceCartItem.md) 类实例。 ||
|#

**返回：**

The `AMAECommerce` 类实例。

### +removeCartItemEventWithItem: {#method_removeCartItemEventWithItem}

```objectivec translate=no
+ (instancetype)removeCartItemEventWithItem:(AMAECommerceCartItem *)item
```

创建一个电商事件，称为`RemoveCartItemEvent`。 使用它来报告从购物车中移除项目。

**参数：**

#|
|| `item` | 从购物车中移除的商品。 The [AMAECommerceCartItem](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/objectivec/AMAECommerceCartItem.md) 类实例。 ||
|#

**返回：**

The `AMAECommerce` 类实例。

### +beginCheckoutEventWithOrder: {#method_beginCheckoutEventWithOrder}

```objectivec translate=no
+ (instancetype)beginCheckoutEventWithOrder:(AMAECommerceOrder *)order
```

创建一个电商事件，称为`BeginCheckoutEvent`。 使用它来报告开始购买。

**参数：**

#|
|| `order` | 购买信息。 The [AMAECommerceOrder](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/objectivec/AMAECommerceOrder.md) 类实例。 ||
|#

**返回：**

The `AMAECommerce` 类实例。

### +purchaseEventWithOrder: {#method_purchaseEventWithOrder}

```objectivec translate=no
+ (instancetype)purchaseEventWithOrder:(AMAECommerceOrder *)order
```

创建一个电商事件，称为`PurchaseEvent`。 使用它来报告已完成的购买。

**参数：**

#|
|| `order` | 购买信息。 The [AMAECommerceOrder](https://appmetrica.yandex.by/docs/zh/sdk/ios/analytics/objectivec/AMAECommerceOrder.md) 类实例。 ||
|#

**返回：**

The `AMAECommerce` 类实例。
