/
ADMS_Measurement.h
320 lines (275 loc) · 9.93 KB
/
ADMS_Measurement.h
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
//
// ADMS_AppMeasurement.h
// Adobe Digital Marketing Suite -- iOS Application Measurement Library
//
// Copyright 1996-2012. Adobe, Inc. All Rights Reserved
#import <Foundation/Foundation.h>
typedef enum {
ADMS_AutoTrackOptionsNone = 0, ///< Disable all auto tracking
ADMS_AutoTrackOptionsLifecycle = 1, ///< Track application lifecycle
ADMS_AutoTrackOptionsNavigation = 2 ///< Track navigation events
} ADMS_AutoTrackOptions; ///< @enum Auto Tracking Options Enumeration
/**
* ADMS App Measurement (iOS)
*
* @class ADMS_Measurement
*/
@interface ADMS_Measurement : NSObject
/**
* @brief Gets instance of measurement singleton
*
* @returns ADMS_Measurement
*/
+ (ADMS_Measurement *)sharedInstance;
#pragma mark - Configuration Methods
/**
* @brief Configure measurement with required tracking information
*
* @param reportSuiteIDs comma delimited list of report suite IDs.
* @param trackingServer the SiteCatalyst tracking server endpoint.
*/
- (void)configureMeasurementWithReportSuiteIDs:(NSString *)reportSuiteIDs
trackingServer:(NSString *)trackingServer;
/**
* @brief Configures auto tracking options
*
* @param options auto tracking options flags.
*/
- (void)setAutoTrackingOptions:(ADMS_AutoTrackOptions)options;
/**
* @brief Brings measurement functionality online
*/
- (void)setOnline;
/**
* @brief Take measurement functionality offline
*/
- (void)setOffline;
#pragma mark - Tracking Methods
#pragma mark Simple Tracking Methods
/**
* @brief Tracks an application state change
*
* @param appState app state description
*
* @note Increments overall page view count. AppState will be tracked as pageName by SiteCatalyst.
*/
- (void)trackAppState:(NSString *)appState;
/**
* @brief Tracks an application state change
*
* @param appState app state description
* @param contextData additional data to send with this state change
*
* @note Increments overall page view count. AppState will be tracked as pageName by SiteCatalyst.
*/
- (void)trackAppState:(NSString *)appState withContextData:(NSDictionary *)contextData;
/**
* @brief Tracks an application event
*
* @param eventNames comma delimited list of events
*
* @note Does not increment overall page view count.
*/
- (void)trackEvents:(NSString *)eventNames;
/**
* @brief Tracks an application event
*
* @param eventNames comma delimited list of events
* @param contextData additional data to send with this event
*
* @note Does not increment overall page view count.
*/
- (void)trackEvents:(NSString *)eventNames withContextData:(NSDictionary *)contextData;
#pragma mark Advanced Tracking Methods
/**
* @brief Sends a tracking call with preset options
*
* @note Increments overall page view count.
*/
- (void)track;
/**
* @brief Sends a tracking call with preset options
*
* @param contextData additional data to send with this event
*
* @note Increments overall page view count.
*/
- (void)trackWithContextData:(NSDictionary *)contextData;
/**
* @brief Sends a tracking call with preset options
*
* @param contextData additional data to send with this event
* @param variables additional variables to send with this event
*
* @note Increments overall page view count.
*/
- (void)trackWithContextData:(NSDictionary *)contextData variables:(NSDictionary *)variables;
/**
* @brief Sends a tracking call with preset options
*
* @param linkURL url of link
* @param linkType link type (must be "o", "e", or "d")
* @param linkName name of link
* @param contextData additional data to send with this event
* @param variables additional variables to send with this event
*
* @note Does not increment overall page view count.
*/
- (void)trackLinkURL:(NSString *)linkURL
withLinkType:(NSString *)linkType
linkName:(NSString *)linkName
contextData:(NSDictionary *)contextData
variables:(NSDictionary *)variables;
/**
* @brief Sends a light tracking call with preset options
*
* @param profileID light profile id
* @param storeForSeconds number of seconds to hold hit while waiting for additional hits
* @param incrementBy number of times to increment metric count associated with light profile id
* @param contextData additional data to send with this call
* @param variables additional variables to send with this call
*
* @note Light tracking must be configured with Adobe ClientCare.
*/
- (void)trackLightWithProfileID:(NSString *)profileID
storeForSeconds:(NSUInteger)storeForSeconds
incrementBy:(NSUInteger)incrementBy
contextData:(NSDictionary *)contextData
variables:(NSDictionary *)variables;
#pragma mark - Getters/Setters
/**
* @brief Sets the value of a specific eVar
*
* @param evarNum number of eVar to set
* @param value value of evar
*/
- (void)setEvar:(NSUInteger)evarNum toValue:(NSString *)value;
/**
* @brief Sets the value of a specific prop
*
* @param propNum number of prop to set
* @param value value of prop
*/
- (void)setProp:(NSUInteger)propNum toValue:(NSString *)value;
/**
* @brief Sets the value of a specific hierarchy var
*
* @param hierNum number of hierarchy var to set
* @param value value of hierarchy var
*/
- (void)setHier:(NSUInteger)hierNum toValue:(NSString *)value;
/**
* @brief Sets the value of a specific list variable
*
* @param listNum number of list variable to set
* @param value value of list variable
*/
- (void)setListVar:(NSUInteger)listNum toValue:(NSString *)value;
/**
* @brief Gets the value of a specific eVar
*
* @param evarNum number of eVar to get
* @returns NSString
*/
- (NSString *)getEvar:(NSUInteger)evarNum;
/**
* @brief Gets the value of a specific prop
*
* @param propNum number of prop to get
* @returns NSString
*/
- (NSString *)getProp:(NSUInteger)propNum;
/**
* @brief Gets the value of a specific hierarchy variable
*
* @param hierNum number of hierarchy variable to get
* @returns NSString
*/
- (NSString *)getHier:(NSUInteger)hierNum;
/**
* @brief Gets the value of a specific list variable
*
* @param listNum number of list var to get
* @returns NSString
*/
- (NSString *)getListVar:(NSUInteger)listNum;
/**
* @brief Clears all persistent track variables
*/
- (void)clearVars;
/**
* @brief Get number of hits currently in the queue
*
* @returns NSUInteger
*/
- (NSUInteger)trackingQueueSize;
/**
* @brief Clear all hits currently in the queue waiting to be sent
*
* @note This will delete all pending hits, they will not be sent or saved.
*/
- (void)clearTrackingQueue;
#pragma mark - Properties
@property(nonatomic, readonly) NSString *version; ///< Library Version
@property(nonatomic) BOOL debugLogging; ///< Enable/Disable Debug Logging
@property(nonatomic, copy) NSString *reportSuiteIDs; ///< Comma-delimited list of Report Suite IDs
@property(nonatomic, copy) NSString *trackingServer; ///< Tracking Server to send data to
/**
* @brief Data Center to generate Tracking Server from
*
* @deprecated Use trackingServer instead.
*/
@property(nonatomic, copy) NSString *dataCenter;
@property(nonatomic, copy) NSString *visitorID; ///< Custom visitor ID @note App-Specific UUID will be used if not set.
@property(nonatomic, copy) NSString *charSet; ///< Character Encoding @note Default is "UTF-8".
@property(nonatomic, copy) NSString *currencyCode; ///< Currency Code @note Default is "USD".
@property(nonatomic) BOOL ssl; ///< Transfer hits by SSL connection @note Default is NO.
@property(nonatomic, copy) NSString *purchaseID; ///< ID to attach to a purchase
@property(nonatomic, copy) NSString *transactionID; ///< ID to attach to a transaction
@property(nonatomic, copy) NSString *appState; ///< State of application at time of hit @note Same as PageName in SiteCatalyst.
@property(nonatomic, copy) NSString *channel; ///< Custom channel variable
@property(nonatomic, copy) NSString *appSection; ///< Application Section @note Same as Server in SiteCatalyst.
@property(nonatomic, copy) NSString *campaign; ///< Related campaign for hit(s).
@property(nonatomic, copy) NSString *products; ///< Comma-delimited list of products.
@property(nonatomic, copy) NSString *events; ///< Comma-delimited list of events.
@property(nonatomic, copy) NSString *geoState; ///< Geographical State/Province variable.
@property(nonatomic, copy) NSString *geoZip; ///< Geographical Zip/Postal Code variable.
@property(nonatomic, retain) NSMutableDictionary *persistentContextData; ///< Persistent context data to include with every hit.
@property(nonatomic) NSTimeInterval lifecycleSessionTimeout;
/**
* @brief Comma-delimited list of variables to send with a trackLink or trackEvent call
*
* @note All set variables and context data will be filtered by linkTrackVars. If linkTrackVars is not set all set variables will be sent.
*/
@property(nonatomic, copy) NSString *linkTrackVars;
/**
* @brief Comma-delimited list of events to send with a trackLink or trackEvent call
*
* @note The events list will be filtered by linkTrackEvents. If linkTrackEvents is not set, all set events will be sent.
*/
@property(nonatomic, copy) NSString *linkTrackEvents;
/**
* @brief Comma-delimited list of variables to send with a trackLight call
*
* @note All set variables and context data will be filtered by lightTrackVars. If lightTrackVars is not set all set variables will be sent.
*/
@property(nonatomic, copy) NSString *lightTrackVars;
/**
* @brief Enable/Disable offline tracking.
*
* @note Defaults to NO. You will need to be using a timestamped report suite to use this functionality.
*/
@property(nonatomic) BOOL offlineTrackingEnabled;
/**
* @brief Amount of time to wait between sending hits that were queued in offline mode.
*
* @note Default is 0.
*/
@property(nonatomic) NSTimeInterval offlineThrottleDelay;
/**
* @brief Maximum number of hits to cache when in offline mode.
*
* @note Default is 1000. Values over 5000 may result in performance issues. When this limit is reached oldest hits will be discarded when new hits come in.
*/
@property(nonatomic) NSUInteger offlineHitLimit;
@end