GAIEcommerceProduct 类参考

概览

用于为 Google Analytics(分析)信标构造产品相关信息的类。

您可以使用此类来报告与商家所售产品相关的信息或用户看到的产品展示次数。此类的实例与“产品操作”和“产品展示列表”两者均可关联。
典型用法:

[tracker set:kGAIScreenName value:@"MyScreen"];
GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView];
GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init];
[product setId:@""PID-1234""];
[product setName:@"Space Monkeys!"];
[product setPrice:@100];
[product setQuantity:@2];
[builder addProductImpression:product impressionList:@"listName"];
[tracker send:[builder build]];

此类继承 NSObject。

实例方法

(GAIEcommerceProduct *) - setId:
 设置用于在 GA 报告中标识产品的 ID。更多...
 
(GAIEcommerceProduct *) - setName:
 设置用于在 GA 报告中标识产品的名称。更多...
 
(GAIEcommerceProduct *) - setBrand:
 设置与 GA 报告中的产品关联的品牌。更多...
 
(GAIEcommerceProduct *) - setCategory:
 设置与 GA 报告中的产品关联的类别。更多...
 
(GAIEcommerceProduct *) - setVariant:
 设置产品的款式。更多...
 
(GAIEcommerceProduct *) - setPrice:
 设置产品的价格。更多...
 
(GAIEcommerceProduct *) - setQuantity:
 设置产品的数量。更多...
 
(GAIEcommerceProduct *) - setCouponCode:
 设置与产品关联的优惠券代码。更多...
 
(GAIEcommerceProduct *) - setPosition:
 设置产品在屏幕上或产品展示列表中的位置等。更多...
 
(GAIEcommerceProduct *) - setCustomDimension:value:
 设置与此产品关联的自定义维度。更多...
 
(GAIEcommerceProduct *) - setCustomMetric:value:
 设置与此产品关联的自定义指标。更多...
 
(NSDictionary *) - buildWithIndex:
 使用此实例中存储的适用于产品操作的字段构建一个 NSDictionary。更多...
 
(NSDictionary *) - buildWithListIndex:index:
 使用此实例中存储的适用于展示列表的字段构建一个 NSDictionary。更多...
 

方法说明

- (GAIEcommerceProduct *) setId: (NSString *)  productId

设置用于在 GA 报告中标识产品的 ID。

- (GAIEcommerceProduct *) setName: (NSString *)  productName

设置用于在 GA 报告中标识产品的名称。

- (GAIEcommerceProduct *) setBrand: (NSString *)  productBrand

设置与 GA 报告中的产品关联的品牌。

- (GAIEcommerceProduct *) setCategory: (NSString *)  productCategory

设置与 GA 报告中的产品关联的类别。

- (GAIEcommerceProduct *) setVariant: (NSString *)  productVariant

设置产品的款式。

- (GAIEcommerceProduct *) setPrice: (NSNumber *)  productPrice

设置产品的价格。

- (GAIEcommerceProduct *) setQuantity: (NSNumber *)  productQuantity

设置产品的数量。

此字段通常不会用于产品展示。

- (GAIEcommerceProduct *) setCouponCode: (NSString *)  productCouponCode

设置与产品关联的优惠券代码。

此字段通常不会用于产品展示。

- (GAIEcommerceProduct *) setPosition: (NSNumber *)  productPosition

设置产品在屏幕上或产品展示列表中的位置等。

- (GAIEcommerceProduct *) setCustomDimension: (NSUInteger)  index
value: (NSString *)  value 

设置与此产品关联的自定义维度。

- (GAIEcommerceProduct *) setCustomMetric: (NSUInteger)  index
value: (NSNumber *)  value 

设置与此产品关联的自定义指标。

- (NSDictionary *) buildWithIndex: (NSUInteger)  index

使用此实例中存储的适用于产品操作的字段构建一个 NSDictionary。

index 参数是此产品在产品操作列表中的索引。
一般情况下,用户无需调用此方法。

- (NSDictionary *) buildWithListIndex: (NSUInteger)  lIndex
index: (NSUInteger)  index 

使用此实例中存储的适用于展示列表的字段构建一个 NSDictionary。

lIndex 参数是产品展示列表的索引,而 index 参数是此产品在该展示列表中的索引。
一般情况下,用户无需调用此方法。