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