YMMECommerce class

Methods of this class create a YMMECommerce instance.

For different user actions, there are appropriate types of E-commerce events. To create a specific event type, use the appropriate YMMECommerce class method.

Note. You can send the YMMECommerce instance using the +reportECommerce:onFailure: method of the YMMYandexMetrica class and the YMMYandexMetricaReporting protocol.

Instance methods

+showScreenEventWithScreen:

Creates an E-commerce event called ShowScreenEvent. Use it to report the opening of a page, such as a list of products, search or home page.

+showProductCardEventWithProduct:screen:

Creates an E-commerce event called ShowProductCardEvent. Use it to report viewing a product profile among others on the list.

+showProductDetailsEventWithProduct:referrer:

Creates an E-commerce event called ShowProductDetailsEvent. Use it to report viewing a product page.

+addCartItemEventWithItem:

Creates an E-commerce event called AddCartItemEvent. Use it to report adding an item to the cart.

+removeCartItemEventWithItem:

Creates an E-commerce event called RemoveCartItemEvent. Use it to report removing an item from the cart.

+beginCheckoutEventWithOrder:

Creates an E-commerce event called BeginCheckoutEvent. Use it to report starting a purchase.

+purchaseEventWithOrder:

Creates an E-commerce event called PurchaseEvent. Use it to report a completed purchase.

+showScreenEventWithScreen:

Creates an E-commerce event called ShowScreenEvent. Use it to report the opening of a page, such as a list of products, search or home page.

+showProductCardEventWithProduct:screen:

Creates an E-commerce event called ShowProductCardEvent. Use it to report viewing a product profile among others on the list.

+showProductDetailsEventWithProduct:referrer:

Creates an E-commerce event called ShowProductDetailsEvent. Use it to report viewing a product page.

+addCartItemEventWithItem:

Creates an E-commerce event called AddCartItemEvent. Use it to report adding an item to the cart.

+removeCartItemEventWithItem:

Creates an E-commerce event called RemoveCartItemEvent. Use it to report removing an item from the cart.

+beginCheckoutEventWithOrder:

Creates an E-commerce event called BeginCheckoutEvent. Use it to report starting a purchase.

+purchaseEventWithOrder:

Creates an E-commerce event called PurchaseEvent. Use it to report a completed purchase.

Method descriptions

+showScreenEventWithScreen:

+ (instancetype)showScreenEventWithScreen:(YMMECommerceScreen *)screen

Creates an E-commerce event called ShowScreenEvent. Use it to report the opening of a page, such as a list of products, search or home page.

Parameters:
screen The screen that was opened. The YMMECommerceScreen class instance.
screen The screen that was opened. The YMMECommerceScreen class instance.

Returns:

The YMMECommerce class instance.

+showProductCardEventWithProduct:screen:

+ (instancetype)showProductCardEventWithProduct:(YMMECommerceProduct *)product
                                         screen:(YMMECommerceScreen *)screen

Creates an E-commerce event called ShowProductCardEvent. Use it to report viewing a product profile among others on the list.

Tip. Before sending the event, make sure that the product profile was shown on the screen for more than N seconds.
Parameters:
product

The product that was shown. The YMMECommerceProduct class instance.

screen

The screen where the product was displayed. The YMMECommerceScreen class instance.

product

The product that was shown. The YMMECommerceProduct class instance.

screen

The screen where the product was displayed. The YMMECommerceScreen class instance.

Returns:

The YMMECommerce class instance.

+showProductDetailsEventWithProduct:referrer:

+ (instancetype)showProductDetailsEventWithProduct:(YMMECommerceProduct *)product
                                          referrer:(nullable YMMECommerceReferrer *)referrer

Creates an E-commerce event called ShowProductDetailsEvent. Use it to report viewing a product page.

Parameters:
product

The product that was shown. The YMMECommerceProduct class instance.

referrer

Information about the source of traffic to the product page. The YMMECommerceReferrer class instance.

product

The product that was shown. The YMMECommerceProduct class instance.

referrer

Information about the source of traffic to the product page. The YMMECommerceReferrer class instance.

Returns:

The YMMECommerce class instance.

+addCartItemEventWithItem:

+ (instancetype)addCartItemEventWithItem:(YMMECommerceCartItem *)item

Creates an E-commerce event called AddCartItemEvent. Use it to report adding an item to the cart.

Parameters:
item

The item that was added to the cart. The YMMECommerceCartItem class instance.

item

The item that was added to the cart. The YMMECommerceCartItem class instance.

Returns:

The YMMECommerce class instance.

+removeCartItemEventWithItem:

+ (instancetype)removeCartItemEventWithItem:(YMMECommerceCartItem *)item

Creates an E-commerce event called RemoveCartItemEvent. Use it to report removing an item from the cart.

Parameters:
item

The item that was removed from the cart. The YMMECommerceCartItem class instance.

item

The item that was removed from the cart. The YMMECommerceCartItem class instance.

Returns:

The YMMECommerce class instance.

+beginCheckoutEventWithOrder:

+ (instancetype)beginCheckoutEventWithOrder:(YMMECommerceOrder *)order

Creates an E-commerce event called BeginCheckoutEvent. Use it to report starting a purchase.

Parameters:
order

Information about the purchase. The YMMECommerceOrder class instance.

order

Information about the purchase. The YMMECommerceOrder class instance.

Returns:

The YMMECommerce class instance.

+purchaseEventWithOrder:

+ (instancetype)purchaseEventWithOrder:(YMMECommerceOrder *)order

Creates an E-commerce event called PurchaseEvent. Use it to report a completed purchase.

Parameters:
order

Information about the purchase. The YMMECommerceOrder class instance.

order

Information about the purchase. The YMMECommerceOrder class instance.

Returns:

The YMMECommerce class instance.