GAIEcommerceProduct.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*!
  2. @header GAIEcommerceProduct.h
  3. @abstract Google Analytics iOS SDK Hit Format Header
  4. @copyright Copyright 2014 Google Inc. All rights reserved.
  5. */
  6. #import <Foundation/Foundation.h>
  7. /*!
  8. * Class to construct product related information for a Google Analytics beacon. Use this class to
  9. * report information about products sold by merchants or impressions of products seen by users.
  10. * Instances of this class can be associated with both Product Actions and Product
  11. * Impression Lists.
  12. * <br>
  13. * Typical usage:
  14. * <code>
  15. * [tracker set:kGAIScreenName value:@"MyScreen"];
  16. * GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView];
  17. * GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init];
  18. * [product setId:@""PID-1234""];
  19. * [product setName:@"Space Monkeys!"];
  20. * [product setPrice:@100];
  21. * [product setQuantity:@2];
  22. * [builder addProductImpression:product impressionList:@"listName"];
  23. * [tracker send:[builder build]];
  24. * </code>
  25. */
  26. @interface GAIEcommerceProduct : NSObject
  27. /*!
  28. Sets the id that is used to identify a product in GA reports.
  29. */
  30. - (GAIEcommerceProduct *)setId:(NSString *)productId;
  31. /*!
  32. Sets the name that is used to indentify the product in GA reports.
  33. */
  34. - (GAIEcommerceProduct *)setName:(NSString *)productName;
  35. /*!
  36. Sets the brand associated with the product in GA reports.
  37. */
  38. - (GAIEcommerceProduct *)setBrand:(NSString *)productBrand;
  39. /*!
  40. Sets the category associated with the product in GA reports.
  41. */
  42. - (GAIEcommerceProduct *)setCategory:(NSString *)productCategory;
  43. /*!
  44. Sets the variant of the product.
  45. */
  46. - (GAIEcommerceProduct *)setVariant:(NSString *)productVariant;
  47. /*!
  48. Sets the price of the product.
  49. */
  50. - (GAIEcommerceProduct *)setPrice:(NSNumber *)productPrice;
  51. /*!
  52. Sets the quantity of the product. This field is usually not used with product impressions.
  53. */
  54. - (GAIEcommerceProduct *)setQuantity:(NSNumber *)productQuantity;
  55. /*!
  56. Sets the coupon code associated with the product. This field is usually not used with product
  57. impressions.
  58. */
  59. - (GAIEcommerceProduct *)setCouponCode:(NSString *)productCouponCode;
  60. /*!
  61. Sets the position of the product on the screen/product impression list, etc.
  62. */
  63. - (GAIEcommerceProduct *)setPosition:(NSNumber *)productPosition;
  64. /*!
  65. Sets the custom dimension associated with this product.
  66. */
  67. - (GAIEcommerceProduct *)setCustomDimension:(NSUInteger)index value:(NSString *)value;
  68. /*!
  69. Sets the custom metric associated with this product.
  70. */
  71. - (GAIEcommerceProduct *)setCustomMetric:(NSUInteger)index value:(NSNumber *)value;
  72. /*!
  73. Builds an NSDictionary of fields stored in this instance suitable for a product action. The
  74. index parameter is the index of this product in the product action list.
  75. <br>
  76. Normally, users will have no need to call this method.
  77. */
  78. - (NSDictionary *)buildWithIndex:(NSUInteger)index;
  79. /*!
  80. Builds an NSDictionary of fields stored in this instance suitable for an impression list. The
  81. lIndex parameter is the index of the product impression list while the index parameter is the
  82. index of this product in that impression list.
  83. <br>
  84. Normally, users will have no need to call this method.
  85. */
  86. - (NSDictionary *)buildWithListIndex:(NSUInteger)lIndex index:(NSUInteger)index;
  87. @end