GAIEcommerceProductAction.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*!
  2. @header GAIProductAction.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 transaction/checkout or other product interaction related information for a
  9. * Google Analytics hit. Use this class to report information about products sold, viewed or
  10. * refunded. This class is intended to be used with GAIDictionaryBuilder.
  11. * <br>
  12. * Typical usage:
  13. * <code>
  14. * [tracker set:kGAIScreenName value:@"MyScreen"];
  15. * GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView];
  16. * GAIEcommerceProductAction *action = [[GAIEcommerceProductAction alloc] init];
  17. * [action setAction:kGAIPAPurchase];
  18. * [action setTransactionId:@"TT-1234"];
  19. * [action setRevenue:@3.14];
  20. * [action setCouponCode:@"EXTRA100"];
  21. * [builder setProductAction:action];
  22. * GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init];
  23. * [product setId:@""PID-1234""];
  24. * [product setName:@"Space Monkeys!"];
  25. * [product setPrice:@100];
  26. * [product setQuantity:@2];
  27. * [builder addProduct:product];
  28. * [tracker send:[builder build]];
  29. * </code>
  30. */
  31. @interface GAIEcommerceProductAction : NSObject
  32. /*!
  33. Sets the product action field for this product action. Valid values can be found in
  34. GAIEcommerceFields.h under "product action values".
  35. */
  36. - (GAIEcommerceProductAction *)setAction:(NSString *)productAction;
  37. /*!
  38. The unique id associated with the transaction. This value is used for kGAIPAPurchase and
  39. kGAIPARefund product actions.
  40. */
  41. - (GAIEcommerceProductAction *)setTransactionId:(NSString *)transactionId;
  42. /*!
  43. Sets the transaction's affiliation value. This value is used for kGAIPAPurchase and
  44. kGAIPARefund product actions.
  45. */
  46. - (GAIEcommerceProductAction *)setAffiliation:(NSString *)affiliation;
  47. /*!
  48. Sets the transaction's total revenue. This value is used for kGAIPAPurchase and kGAIPARefund
  49. product actions.
  50. */
  51. - (GAIEcommerceProductAction *)setRevenue:(NSNumber *)revenue;
  52. /*!
  53. Sets the transaction's total tax. This value is used for kGAIPAPurchase and kGAIPARefund
  54. product actions.
  55. */
  56. - (GAIEcommerceProductAction *)setTax:(NSNumber *)tax;
  57. /*!
  58. Sets the transaction's total shipping costs. This value is used for kGAIPAPurchase and
  59. kGAIPARefund product actions.
  60. */
  61. - (GAIEcommerceProductAction *)setShipping:(NSNumber *)shipping;
  62. /*!
  63. Sets the coupon code used in this transaction. This value is used for kGAIPAPurchase and
  64. kGAIPARefund product actions.
  65. */
  66. - (GAIEcommerceProductAction *)setCouponCode:(NSString *)couponCode;
  67. /*!
  68. Sets the checkout process's progress. This value is used for kGAICheckout and
  69. kGAICheckoutOptions product actions.
  70. */
  71. - (GAIEcommerceProductAction *)setCheckoutStep:(NSNumber *)checkoutStep;
  72. /*!
  73. Sets the option associated with the checkout. This value is used for kGAICheckout and
  74. kGAICheckoutOptions product actions.
  75. */
  76. - (GAIEcommerceProductAction *)setCheckoutOption:(NSString *)checkoutOption;
  77. /*!
  78. Sets the list name associated with the products in Google Analytics beacons. This value is
  79. used in kGAIPADetail and kGAIPAClick product actions.
  80. */
  81. - (GAIEcommerceProductAction *)setProductActionList:(NSString *)productActionList;
  82. /*!
  83. Sets the list source name associated with the products in Google Analytics beacons. This value
  84. is used in kGAIPADetail and kGAIPAClick product actions.
  85. */
  86. - (GAIEcommerceProductAction *)setProductListSource:(NSString *)productListSource;
  87. /*!
  88. Builds an NSDictionary of fields stored in this instance representing this product action.
  89. <br>
  90. Normally, users will have no need to call this method.
  91. */
  92. - (NSDictionary *)build;
  93. @end