GAIEcommerceProduct Class Reference

Overview

Class to construct product related information for a Google Analytics beacon.

Use this class to report information about products sold by merchants or impressions of products seen by users. Instances of this class can be associated with both Product Actions and Product Impression Lists.
Typical usage:

[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]];

Inherits NSObject.

Instance Methods

(GAIEcommerceProduct *) - setId:
 Sets the id that is used to identify a product in GA reports. More...
 
(GAIEcommerceProduct *) - setName:
 Sets the name that is used to indentify the product in GA reports. More...
 
(GAIEcommerceProduct *) - setBrand:
 Sets the brand associated with the product in GA reports. More...
 
(GAIEcommerceProduct *) - setCategory:
 Sets the category associated with the product in GA reports. More...
 
(GAIEcommerceProduct *) - setVariant:
 Sets the variant of the product. More...
 
(GAIEcommerceProduct *) - setPrice:
 Sets the price of the product. More...
 
(GAIEcommerceProduct *) - setQuantity:
 Sets the quantity of the product. More...
 
(GAIEcommerceProduct *) - setCouponCode:
 Sets the coupon code associated with the product. More...
 
(GAIEcommerceProduct *) - setPosition:
 Sets the position of the product on the screen/product impression list, etc. More...
 
(GAIEcommerceProduct *) - setCustomDimension:value:
 Sets the custom dimension associated with this product. More...
 
(GAIEcommerceProduct *) - setCustomMetric:value:
 Sets the custom metric associated with this product. More...
 
(NSDictionary *) - buildWithIndex:
 Builds an NSDictionary of fields stored in this instance suitable for a product action. More...
 
(NSDictionary *) - buildWithListIndex:index:
 Builds an NSDictionary of fields stored in this instance suitable for an impression list. More...
 

Method Documentation

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

Sets the id that is used to identify a product in GA reports.

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

Sets the name that is used to indentify the product in GA reports.

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

Sets the brand associated with the product in GA reports.

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

Sets the category associated with the product in GA reports.

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

Sets the variant of the product.

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

Sets the price of the product.

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

Sets the quantity of the product.

This field is usually not used with product impressions.

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

Sets the coupon code associated with the product.

This field is usually not used with product impressions.

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

Sets the position of the product on the screen/product impression list, etc.

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

Sets the custom dimension associated with this product.

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

Sets the custom metric associated with this product.

- (NSDictionary *) buildWithIndex: (NSUInteger)  index

Builds an NSDictionary of fields stored in this instance suitable for a product action.

The index parameter is the index of this product in the product action list.
Normally, users will have no need to call this method.

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

Builds an NSDictionary of fields stored in this instance suitable for an impression list.

The lIndex parameter is the index of the product impression list while the index parameter is the index of this product in that impression list.
Normally, users will have no need to call this method.