summaryrefslogtreecommitdiff
path: root/StoneIsland/plugins/cordova-plugin-google-analytics/ios/GAIEcommerceProductAction.h
blob: e3da1c150228a524823c1154ac968009d1f55f9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*!
 @header    GAIProductAction.h
 @abstract  Google Analytics iOS SDK Hit Format Header
 @copyright Copyright 2014 Google Inc. All rights reserved.
 */

#import <Foundation/Foundation.h>

/*!
 * Class to construct transaction/checkout or other product interaction related information for a
 * Google Analytics hit. Use this class to report information about products sold, viewed or
 * refunded. This class is intended to be used with GAIDictionaryBuilder.
 * <br>
 * Typical usage:
 * <code>
 * [tracker set:kGAIScreenName value:@"MyScreen"];
 * GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView];
 * GAIEcommerceProductAction *action = [[GAIEcommerceProductAction alloc] init];
 * [action setAction:kGAIPAPurchase];
 * [action setTransactionId:@"TT-1234"];
 * [action setRevenue:@3.14];
 * [action setCouponCode:@"EXTRA100"];
 * [builder setProductAction:action];
 * GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init];
 * [product setId:@""PID-1234""];
 * [product setName:@"Space Monkeys!"];
 * [product setPrice:@100];
 * [product setQuantity:@2];
 * [builder addProduct:product];
 * [tracker send:[builder build]];
 * </code>
 */
@interface GAIEcommerceProductAction : NSObject

/*!
 Sets the product action field for this product action. Valid values can be found in
 GAIEcommerceFields.h under "product action values".
 */
- (GAIEcommerceProductAction *)setAction:(NSString *)productAction;

/*!
 The unique id associated with the transaction.  This value is used for kGAIPAPurchase and
 kGAIPARefund product actions.
 */
- (GAIEcommerceProductAction *)setTransactionId:(NSString *)transactionId;

/*!
 Sets the transaction's affiliation value.  This value is used for kGAIPAPurchase and
 kGAIPARefund product actions.
 */
- (GAIEcommerceProductAction *)setAffiliation:(NSString *)affiliation;

/*!
 Sets the transaction's total revenue.  This value is used for kGAIPAPurchase and kGAIPARefund
 product actions.
 */
- (GAIEcommerceProductAction *)setRevenue:(NSNumber *)revenue;

/*!
 Sets the transaction's total tax.  This value is used for kGAIPAPurchase and kGAIPARefund
 product actions.
 */
- (GAIEcommerceProductAction *)setTax:(NSNumber *)tax;

/*!
 Sets the transaction's total shipping costs.  This value is used for kGAIPAPurchase and
 kGAIPARefund product actions.
 */
- (GAIEcommerceProductAction *)setShipping:(NSNumber *)shipping;

/*!
 Sets the coupon code used in this transaction.  This value is used for kGAIPAPurchase and
 kGAIPARefund product actions.
 */
- (GAIEcommerceProductAction *)setCouponCode:(NSString *)couponCode;

/*!
 Sets the checkout process's progress.  This value is used for kGAICheckout and
 kGAICheckoutOptions product actions.
 */
- (GAIEcommerceProductAction *)setCheckoutStep:(NSNumber *)checkoutStep;

/*!
 Sets the option associated with the checkout.  This value is used for kGAICheckout and
 kGAICheckoutOptions product actions.
 */
- (GAIEcommerceProductAction *)setCheckoutOption:(NSString *)checkoutOption;

/*!
 Sets the list name associated with the products in Google Analytics beacons.  This value is
 used in kGAIPADetail and kGAIPAClick product actions.
 */
- (GAIEcommerceProductAction *)setProductActionList:(NSString *)productActionList;

/*!
 Sets the list source name associated with the products in Google Analytics beacons.  This value
 is used in kGAIPADetail and kGAIPAClick product actions.
 */
- (GAIEcommerceProductAction *)setProductListSource:(NSString *)productListSource;

/*!
 Builds an NSDictionary of fields stored in this instance representing this product action.
 <br>
 Normally, users will have no need to call this method.
 */
- (NSDictionary *)build;
@end