GAIEcommerceFields.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*!
  2. @header GAIEcommerceFields.h
  3. @abstract Google Analytics iOS SDK Ecommerce Hit Format Header
  4. @copyright Copyright 2014 Google Inc. All rights reserved.
  5. */
  6. #import <Foundation/Foundation.h>
  7. /*!
  8. This class provides several fields and methods useful as wire format parameters for
  9. Enhanced Ecommerce. See the online developer guides for Enhanced Ecommerce for details
  10. on how to use the Enhanced Ecommerce features.
  11. */
  12. // Enhanced Ecommerce Product fields
  13. extern NSString *const kGAIProductId;
  14. extern NSString *const kGAIProductName;
  15. extern NSString *const kGAIProductBrand;
  16. extern NSString *const kGAIProductCategory;
  17. extern NSString *const kGAIProductVariant;
  18. extern NSString *const kGAIProductPrice;
  19. extern NSString *const kGAIProductQuantity;
  20. extern NSString *const kGAIProductCouponCode;
  21. extern NSString *const kGAIProductPosition;
  22. extern NSString *const kGAIProductAction;
  23. // product action values
  24. extern NSString *const kGAIPADetail;
  25. extern NSString *const kGAIPAClick;
  26. extern NSString *const kGAIPAAdd;
  27. extern NSString *const kGAIPARemove;
  28. extern NSString *const kGAIPACheckout;
  29. extern NSString *const kGAIPACheckoutOption;
  30. extern NSString *const kGAIPAPurchase;
  31. extern NSString *const kGAIPARefund;
  32. // product action fields
  33. // used for 'purchase' and 'refund' actions
  34. extern NSString *const kGAIPATransactionId;
  35. extern NSString *const kGAIPAAffiliation;
  36. extern NSString *const kGAIPARevenue;
  37. extern NSString *const kGAIPATax;
  38. extern NSString *const kGAIPAShipping;
  39. extern NSString *const kGAIPACouponCode;
  40. // used for 'checkout' action
  41. extern NSString *const kGAICheckoutStep;
  42. extern NSString *const kGAICheckoutOption;
  43. // used for 'detail' and 'click' actions
  44. extern NSString *const kGAIProductActionList;
  45. extern NSString *const kGAIProductListSource;
  46. // Enhanced Ecommerce Impressions fields
  47. extern NSString *const kGAIImpressionName;
  48. extern NSString *const kGAIImpressionListSource;
  49. extern NSString *const kGAIImpressionProduct;
  50. extern NSString *const kGAIImpressionProductId;
  51. extern NSString *const kGAIImpressionProductName;
  52. extern NSString *const kGAIImpressionProductBrand;
  53. extern NSString *const kGAIImpressionProductCategory;
  54. extern NSString *const kGAIImpressionProductVariant;
  55. extern NSString *const kGAIImpressionProductPosition;
  56. extern NSString *const kGAIImpressionProductPrice;
  57. // Enhanced Ecommerce Promotions fields
  58. extern NSString *const kGAIPromotionId;
  59. extern NSString *const kGAIPromotionName;
  60. extern NSString *const kGAIPromotionCreative;
  61. extern NSString *const kGAIPromotionPosition;
  62. // Promotion actions
  63. extern NSString *const kGAIPromotionAction;
  64. extern NSString *const kGAIPromotionView;
  65. extern NSString *const kGAIPromotionClick;
  66. @interface GAIEcommerceFields : NSObject
  67. /*!
  68. Generates an enhanced ecommerce product field. Note that field names generated by
  69. customDimensionForIndex and customMetricForIndex can be used as suffixes.
  70. @param index the index of the product
  71. @param suffix the product field suffix (such as kGAIProductPrice).
  72. @return an NSString representing the product field parameter
  73. */
  74. + (NSString *)productFieldForIndex:(NSUInteger)index suffix:(NSString *)suffix;
  75. /*!
  76. Genrates an enhanced ecommerce impression list field name with an index. The return value of
  77. this method should also be used as input to the productImpressionForList method below.
  78. @param index the index of the impression list
  79. @return an NSString representing the impression list parameter
  80. */
  81. + (NSString *)impressionListForIndex:(NSUInteger)index;
  82. /*!
  83. Generates an enhanced ecommerce product impression field with the impression list, product index
  84. and product suffix as parameters. The output of the method impressionListForIndex above should be
  85. used as the input list for this method. The output of customDimensionForIndex and
  86. customMetricForIndex can be used as suffixes.
  87. @param list the impression list for this product impression
  88. @param index the index of this product in the impression list
  89. @param suffix the product impression suffix for this field
  90. @return an NSString representing this product impression field parameter
  91. */
  92. + (NSString *)productImpressionForList:(NSString *)list
  93. index:(NSUInteger)index
  94. suffix:(NSString *)Suffix;
  95. /*!
  96. Generates an enhanced ecommerce promotion field with an index and suffix.
  97. @param index the index of the promotion
  98. @param suffix the promotion suffix (such as kGAIPromotionId)
  99. @return an NSString representing this promotion field paramter
  100. */
  101. + (NSString *)promotionForIndex:(NSUInteger)index suffix:(NSString *)suffix;
  102. @end