iOS SDK  12.0.0
 All Classes Functions Enumerations Enumerator Groups Pages
Flurry.h
1 //
2 // Flurry.h
3 // Flurry iOS Analytics Agent
4 //
5 // Copyright (c) 2021 Yahoo. All rights reserved.
6 //
7 // Methods in this header file are for use with Flurry Analytics
8 
9 #import <UIKit/UIKit.h>
10 #if !TARGET_OS_WATCH
11 @class SKPaymentTransaction;
12 #endif
13 #if TARGET_OS_TV
14 @class JSContext;
15 #endif
16 
17 #import "FlurrySessionBuilder.h"
18 
22 typedef NS_ENUM(NSUInteger, FlurryPaymentTransactionState) {
23  FlurryPaymentTransactionStatePurchasing NS_SWIFT_NAME(purchasing) = 0,
24  FlurryPaymentTransactionStateSuccess NS_SWIFT_NAME(success),
25  FlurryPaymentTransactionStateFailure NS_SWIFT_NAME(failure),
26  FlurryPaymentTransactionStateRestored NS_SWIFT_NAME(restored),
27  FlurryPaymentTransactionStateDeferred NS_SWIFT_NAME(deffered)
28 };
29 
30 
31 typedef NS_ENUM(NSUInteger, FlurryEventRecordStatus) {
32  FlurryEventFailed NS_SWIFT_NAME(failed) = 0,
33  FlurryEventRecorded NS_SWIFT_NAME(recorded),
34  FlurryEventUniqueCountExceeded NS_SWIFT_NAME(uniqueCountExceeded),
35  FlurryEventParamsCountExceeded NS_SWIFT_NAME(paramsCountExceeded),
36  FlurryEventLogCountExceeded NS_SWIFT_NAME(logCountExceeded),
37  FlurryEventLoggingDelayed NS_SWIFT_NAME(loggingDelayed),
38  FlurryEventAnalyticsDisabled NS_SWIFT_NAME(analyticsDisabled),
39  FlurryEventParametersMismatched NS_SWIFT_NAME(parametersMismatched)
40 };
41 
42 
49 typedef NS_ENUM(NSUInteger, FlurrySyndicationEvent){
50  FlurrySyndicationReblog NS_SWIFT_NAME(reblog) = 0,
51  FlurrySyndicationFastReblog NS_SWIFT_NAME(fastReblog),
52  FlurrySyndicationSourceClick NS_SWIFT_NAME(sourceClick),
53  FlurrySyndicationLike NS_SWIFT_NAME(like),
54  FlurrySyndicationShareClick NS_SWIFT_NAME(shareClick),
55  FlurrySyndicationPostSend NS_SWIFT_NAME(postSend)
56 };
57 
58 extern NSString* _Nonnull const kSyndicationiOSDeepLink;
59 extern NSString* _Nonnull const kSyndicationAndroidDeepLink;
60 extern NSString* _Nonnull const kSyndicationWebDeepLink;
61 
62 
63 typedef NS_ENUM(NSUInteger, FlurryTransactionRecordStatus) {
64  FlurryTransactionRecordFailed NS_SWIFT_NAME(failed) = 0,
65  FlurryTransactionRecorded NS_SWIFT_NAME(recorded),
66  FlurryTransactionRecordExceeded NS_SWIFT_NAME(recordExceeded),
67  FlurryTransactionRecodingDisabled NS_SWIFT_NAME(recordingDisabled)
68 };
69 
70 #if !TARGET_OS_WATCH
71 
85 @protocol FlurryDelegate <NSObject>
86 
99 - (void)flurrySessionDidCreateWithInfo:(nonnull NSDictionary*)info;
100 
101 @end
102 
103 #if TARGET_OS_IOS
104 
107 @protocol FlurryFetchObserver <NSObject>
108 
109 @optional
110 
117 - (void)onFetched:(NSDictionary<NSString *, NSString *> *_Nullable)publisherData;
118 
119 @end
120 #endif
121 
137 @interface Flurry : NSObject {
138 }
139 
140 #pragma mark - Pre-Session Calls
141 
146 
160 + (nonnull NSString *)getFlurryAgentVersion;
161 
179 + (void)setShowErrorInLogEnabled:(BOOL)value
180 NS_SWIFT_NAME(set(showErrorInLogEnabled:));
181 
195 + (void)setLogLevel:(FlurryLogLevel)value
196 NS_SWIFT_NAME(set(logLevel:));
198 
199 
200 
201 #pragma mark - Flurry Delegate setters
202 
219 + (void)setDelegate:(nonnull id<FlurryDelegate>)delegate
220 NS_SWIFT_NAME(set(delegate:));
221 
237 + (void)setDelegate:(nonnull id<FlurryDelegate>)delegate withCallbackQueue:(nonnull dispatch_queue_t)flurryCallbackQueue
238 NS_SWIFT_NAME(set(delegate:callbackQueue:));
239 
240 #pragma mark - start session APIs'
241 
247 
278 + (void)startSession:(nonnull NSString *)apiKey
279 NS_SWIFT_NAME(startSession(apiKey:));
280 
281 
314 + (void) startSession:(nonnull NSString *)apiKey withOptions:(nullable id)options
315 NS_SWIFT_NAME(startSession(apiKey:options:));
316 
317 
355 + (void) startSession:(nonnull NSString *)apiKey withOptions:(nullable id)options withSessionBuilder:(nullable FlurrySessionBuilder*) sessionBuilder
356 NS_SWIFT_NAME(startSession(apiKey:options:sessionBuilder:));
357 
358 
392 + (void) startSession:(nonnull NSString *)apiKey withSessionBuilder:(nullable FlurrySessionBuilder *)sessionBuilder
393 NS_SWIFT_NAME(startSession(apiKey:sessionBuilder:));
395 
396 #pragma mark - Session Details
397 
412 + (BOOL)activeSessionExists;
413 
429 + (nonnull NSString*)getSessionID;
430 
431 #pragma mark - Manual session pausing
432 
433 #if !TARGET_OS_TV
434 
450 + (void)pauseBackgroundSession;
451 #endif
452 
453 #pragma mark - User Info Setters and Getters
454 
459 
469 + (void)setUserID:(nullable NSString *)userID
470 NS_SWIFT_NAME(set(userId:));
471 
485 + (void)setAge:(int)age
486 NS_SWIFT_NAME(set(age:));
487 
502 + (void)setGender:(nonnull NSString *)gender
503 NS_SWIFT_NAME(set(gender:)); // user's gender m or f
504 
506 
539 + (BOOL)trackPreciseLocation:(BOOL)state;
540 
551 + (void) setIAPReportingEnabled:(BOOL)value
552 NS_SWIFT_NAME(set(iapReportingEnabled:));
553 
554 
555 #pragma mark - Add sessionOrigin, originAttributes and sessionProperties
556 
575 + (void)addSessionOrigin:(nonnull NSString *)sessionOriginName
576 NS_SWIFT_NAME(add(sessionOriginName:));
577 
598 + (void)addSessionOrigin:(nonnull NSString *)sessionOriginName
599  withDeepLink:(nonnull NSString *)deepLink
600 NS_SWIFT_NAME(add(sessionOriginName:deepLink:));
601 
631 + (void)sessionProperties:(nonnull NSDictionary *)parameters;
632 
654 + (void)addOrigin:(nonnull NSString *)originName
655  withVersion:(nonnull NSString *)originVersion
656 NS_SWIFT_NAME(add(originName:originVersion:));
657 
689 + (void)addOrigin:(nonnull NSString *)originName
690  withVersion:(nonnull NSString*)originVersion
691  withParameters:(nullable NSDictionary *)parameters
692 NS_SWIFT_NAME(add(originName:originVersion:parameters:));
693 
694 #pragma mark - Event Logging
695 
700 
737 + (FlurryEventRecordStatus)logEvent:(nonnull NSString *)eventName
738 NS_SWIFT_NAME(log(eventName:));
739 
784 + (FlurryEventRecordStatus)logEvent:(nonnull NSString *)eventName
785  withParameters:(nullable NSDictionary *)parameters
786 NS_SWIFT_NAME(log(eventName:parameters:));
787 
809 + (FlurryEventRecordStatus) logEvent:(FlurrySyndicationEvent) syndicationEvent
810  syndicationID:(nonnull NSString *) syndicationID
811  parameters:(nullable NSDictionary *) parameters
812 NS_SWIFT_NAME(log(syndicationEvent:syndicationID:parameters:));
813 
825 + (void) logPaymentTransaction:(nonnull SKPaymentTransaction *)transaction
826  statusCallback:(nullable void(^)(FlurryTransactionRecordStatus))statusCallback
827 NS_SWIFT_NAME(log(transaction:statusCallback:));
828 
829 
846 + (void) logPaymentTransactionWithTransactionId:(nonnull NSString *)transactionId
847  productId:(nonnull NSString *)productId
848  quantity:(NSUInteger)quantity
849  price:(double)price
850  currency:(nonnull NSString *)currency
851  productName:(nonnull NSString *)productName
852  transactionState:(FlurryPaymentTransactionState)transactionState
853  userDefinedParams:(nullable NSDictionary *)transactionParams
854  statusCallback:(nullable void(^)(FlurryTransactionRecordStatus))statusCallback
855 NS_SWIFT_NAME(log(transactionId:productId:quantity:price:currency:productName:transactionState:transactionParams:statusCallback:));
856 
857 #pragma mark - Timed Event Logging
858 
898 + (FlurryEventRecordStatus)logEvent:(nonnull NSString *)eventName timed:(BOOL)timed
899 NS_SWIFT_NAME(log(eventName:timed:));
900 
948 + (FlurryEventRecordStatus)logEvent:(nonnull NSString *)eventName withParameters:(nullable NSDictionary *)parameters timed:(BOOL)timed
949 NS_SWIFT_NAME(log(eventName:parameters:timed:));
950 
996 + (void)endTimedEvent:(nonnull NSString *)eventName withParameters:(nullable NSDictionary *)parameters
997 NS_SWIFT_NAME(endTimedEvent(eventName:parameters:)); // non-nil parameters will update the parameters
998 
999 #pragma mark - Exceptions Logging
1000 
1029 + (void)logError:(nonnull NSString *)errorID
1030  message:(nullable NSString *)message
1031  exception:(nullable NSException *)exception
1032 NS_SWIFT_NAME(log(errorId:message:exception:));
1033 
1064 + (void)logError:(nonnull NSString *)errorID
1065  message:(nullable NSString *)message
1066  exception:(nullable NSException *)exception
1067  withParameters:(nullable NSDictionary*)parameters
1068 NS_SWIFT_NAME(log(errorId:message:exception:parameters:));
1069 
1070 #pragma mark - Error Logging
1071 
1089 + (void)logError:(nonnull NSString *)errorID
1090  message:(nullable NSString *)message
1091  error:(nullable NSError *)error
1092 NS_SWIFT_NAME(log(errorId:message:error:));
1093 
1113 + (void)logError:(nonnull NSString *)errorID
1114  message:(nullable NSString *)message
1115  error:(nullable NSError *)error
1116  withParameters:(nullable NSDictionary*)parameters
1117 NS_SWIFT_NAME(log(errorId:message:error:parameters:));
1118 
1136 + (void)leaveBreadcrumb:(nonnull NSString*)breadcrumb;
1138 
1139 #pragma mark - TVML JSContext
1140 
1141 #if TARGET_OS_TV
1142 
1202 + (void)registerJSContextWithContext:(JSContext * _Nonnull)jscontext;
1203 #endif
1204 
1205 #pragma mark - Privacy dashboard
1206 
1217 + (void)openPrivacyDashboard:(nullable void(^)(BOOL success))completionHandler;
1218 
1219 #if TARGET_OS_IOS
1220 #pragma mark - Publisher Segmentation
1221 
1227 + (BOOL)isFetchFinished;
1228 
1235 + (void)registerFetchObserver:(id<FlurryFetchObserver> _Nonnull)observer withExecutionQueue:(dispatch_queue_t _Nonnull)queue
1236 NS_SWIFT_NAME(registerFetchObserver(_:executionQueue:));
1237 
1243 + (void)unregisterFetchObserver:(id<FlurryFetchObserver> _Nonnull)observer;
1244 
1251 + (nullable NSDictionary<NSString *, NSString *> *)getPublisherData;
1252 
1260 + (void)fetch;
1261 
1262 #endif
1263 
1275 + (void)setAppVersion:(nonnull NSString *)version
1276 NS_SWIFT_NAME(set(appVersion:));
1277 
1289 + (void)setSessionContinueSeconds:(int)seconds
1290 NS_SWIFT_NAME(set(sessionContinueSeconds:));
1291 
1301 + (void)setCountBackgroundSessions:(BOOL)value
1302 NS_SWIFT_NAME(set(countBackgroundSessions:));
1303 
1304 
1311 + (BOOL)isInitialized;
1312 
1313 
1314 @end
1315 
1316 #endif