// // GameAnalytics.h // GA-SDK-IOS // // Copyright (c) 2015 GameAnalytics. All rights reserved. // #import /*! @enum @discussion This enum is used to specify flow in resource events @constant GAResourceFlowTypeSource Used when adding to a resource currency @constant GAResourceFlowTypeSink Used when subtracting from a resource currency */ typedef enum GAResourceFlowType : NSInteger { GAResourceFlowTypeSource = 1, GAResourceFlowTypeSink = 2 } GAResourceFlowType; /*! @enum @discussion This enum is used to specify status for progression event @constant GAProgressionStatusStart User started progression @constant GAProgressionStatusComplete User succesfully ended a progression @constant GAProgressionStatusFail User failed a progression */ typedef enum GAProgressionStatus : NSInteger { GAProgressionStatusStart = 1, GAProgressionStatusComplete = 2, GAProgressionStatusFail = 3 } GAProgressionStatus; /*! @enum @discussion This enum is used to specify severity of an error event @constant GAErrorSeverityDebug @constant GAErrorSeverityInfo @constant GAErrorSeverityWarning @constant GAErrorSeverityError @constant GAErrorSeverityCritical */ typedef enum GAErrorSeverity : NSInteger { GAErrorSeverityDebug = 1, GAErrorSeverityInfo = 2, GAErrorSeverityWarning = 3, GAErrorSeverityError = 4, GAErrorSeverityCritical = 5 } GAErrorSeverity; /*! @enum @discussion This enum is used to specify action of an ad event @constant GAAdActionClicked @constant GAAdActionShow @constant GAAdActionFailedShow @constant GAAdActionRewardReceived @constant GAAdActionRequest @constant GAAdActionLoaded */ typedef enum GAAdAction : NSInteger { GAAdActionClicked = 1, GAAdActionShow = 2, GAAdActionFailedShow = 3, GAAdActionRewardReceived = 4, GAAdActionRequest = 5, GAAdActionLoaded = 6 } GAAdAction; /*! @enum @discussion This enum is used to specify type of an ad event @constant GAAdTypeVideo @constant GAAdTypeRewardedVideo @constant GAAdTypePlayable @constant GAAdTypeInterstitial @constant GAAdTypeOfferWall @constant GAAdTypeBanner */ typedef enum GAAdType : NSInteger { GAAdTypeVideo = 1, GAAdTypeRewardedVideo = 2, GAAdTypePlayable = 3, GAAdTypeInterstitial = 4, GAAdTypeOfferWall = 5, GAAdTypeBanner = 6 } GAAdType; /*! @enum @discussion This enum is used to specify error reason of an ad event @constant GAAdErrorUnknown @constant GAAdErrorOffline @constant GAAdErrorNoFill @constant GAAdErrorInternalError @constant GAAdErrorInvalidRequest @constant GAAdErrorUnableToPrecache */ typedef enum GAAdError : NSInteger { GAAdErrorUnknown = 1, GAAdErrorOffline = 2, GAAdErrorNoFill = 3, GAAdErrorInternalError = 4, GAAdErrorInvalidRequest = 5, GAAdErrorUnableToPrecache = 6 } GAAdError; //Similar to IRemoteConfigsListener in the GameAnalytics Android library @protocol GARemoteConfigsDelegate @optional - (void) onRemoteConfigsUpdated; // Updated everytime when configurations are added @end @class GameAnalytics; @interface GameAnalytics : NSObject /*! @method @abstract Define available 1st custom dimensions @discussion Example usage:

 NSArray *dimensionArray = @[@"dimA", @"dimB", @"dimC"];
[GameAnalytics configureAvailableCustomDimensions01:dimensionArray];
@param customDimensions Must be an array of strings.
Array max length=20, String max length=32) @availability Available since 2.0.0 @attribute Note! This method must be called before initializing the SDK */ + (void)configureAvailableCustomDimensions01:(NSArray *)customDimensions; /*! @method @abstract Set available 2nd custom dimensions @discussion Example usage:

 NSArray *available = @[@"dimD", @"dimE", @"dimF"];
[GameAnalytics configureAvailableCustomDimensions02:dimensionArray;
@param customDimensions Must be an array of strings.
(Array max length=20, String max length=32) @availability Available since 2.0.0 @attribute Note! This method must be called before initializing the SDK */ + (void)configureAvailableCustomDimensions02:(NSArray *)customDimensions; /*! @method @abstract Set available 3rd custom dimensions @discussion Example usage:

 NSArray *available = @[@"dimA", @"dimB", @"dimC"];
[GameAnalytics configureAvailableCustomDimensions03:dimensionArray];
@param customDimensions Must be an array of strings.
(Array max length=20, String max length=32) @availability Available since 2.0.0 @attribute Note! This method must be called before initializing the SDK */ + (void)configureAvailableCustomDimensions03:(NSArray *)customDimensions; /*! @method @abstract Set available resource currencies @discussion Example usage:

 NSArray *availableCurrencies = @[@"gems", @"gold"];
[GameAnalytics configureAvailableResourceCurrencies:availableCurrencies];
@param resourceCurrencies Must be an array of strings.
(Array max length=20, String max length=32) @availability Available since 2.0.0 @attribute Note! This method must be called before initializing the SDK */ + (void)configureAvailableResourceCurrencies:(NSArray *)resourceCurrencies; /*! @method @abstract Set available resource item types @discussion Example usage:

 NSArray *availableItemTypes = @[@"upgrades", @"powerups"];
[GameAnalytics configureAvailableResourceItemTypes:availableItemTypes];
@param resourceItemTypes Must be an array of strings.
(Array max length=20, String max length=32) @availability Available since 2.0.0 @attribute Note! This method must be called before initializing the SDK */ + (void)configureAvailableResourceItemTypes:(NSArray *)resourceItemTypes; /*! @method @abstract Set app build version @discussion Example usage:

 [GameAnalytics configureBuild:@"0.0.1"];
 
@param build (String max length=32) @availability Available since 2.0.0 @attribute Note! This method must be called before initializing the SDK */ + (void)configureBuild:(NSString *)build; /*! @method @abstract Set a custom unique user_id identifying the user. @discussion Example usage:

 [GameAnalytics configureUserId:@"24566"];
 
@param userId (String max length=64) @availability Available since 2.2.0 @attribute Note! This method must be called before initializing the SDK */ + (void)configureUserId:(NSString *)userId; /* @IF WRAPPER */ /* Used ONLY by GameAnalytics wrapper SDK's (for example Unity). Never call this manually! */ + (void)configureSdkVersion:(NSString *)wrapperSdkVersion; /* @ENDIF WRAPPER */ /*! @method @abstract Set app engine version @discussion Example usage:

 [GameAnalytics configureEngineVersion:@"unreal 4.8.1"];
 
@param engineVersion (String) @availability Available since 2.0.0 @attribute Note! This method must be called before initializing the SDK */ + (void)configureEngineVersion:(NSString *)engineVersion; /*! @method @abstract Enable auto detect of app version to use for build field @discussion Example usage:

 [GameAnalytics configureAutoDetectAppVersion:YES];
 
@param flag (String) @availability Available since 4.1.0 @attribute Note! This method must be called before initializing the SDK */ + (void)configureAutoDetectAppVersion:(BOOL)flag; /*! @method @abstract Configure the game key and secret key before initializing. Used by certain frameworks (like Frabric.io) needing to set the keys during configure phase. @discussion Example usage:

 [GameAnalytics configureGameKey:@"123456789ABCDEFGHIJKLMNOPQRSTU" gameSecret:@"123456789ABCDEFGHIJKLMNOPQRSTU12345678"];
 
@param gameKey (String) @param gameSecret (String) @availability Available since 2.0.8 */ + (void)configureGameKey:(NSString *)gameKey gameSecret:(NSString *)gameSecret; /*! @method @abstract Initialize GameAnalytics SDK @discussion Example usage:

 [GameAnalytics initializeWithGameKey:@"123456789ABCDEFGHIJKLMNOPQRSTU" gameSecret:@"123456789ABCDEFGHIJKLMNOPQRSTU12345678"];
 
@param gameKey (String) @param gameSecret (String) @availability Available since 2.0.0 */ + (void)initializeWithGameKey:(NSString *)gameKey gameSecret:(NSString *)gameSecret; /*! @method @abstract Initialize GameAnalytics SDK when the game key and game secret has been configured earlier. @discussion Example usage:

 [GameAnalytics initializeWithConfiguredGameKeyAndGameSecret];
 
@availability Available since 2.0.8 @attribute Note! This method can only be used if the configureGameKey:gameSecret: method is called before. */ + (void)initializeWithConfiguredGameKeyAndGameSecret; /*! @method @abstract Add new business event with receipt @param currency Currency code in ISO 4217 format. (e.g. USD) @param amount Amount in cents (int). (e.g. 99) @param itemType Item Type bought. (e.g. Gold Pack) @param itemId Item bought. (e.g. 1000 gold) @param receipt Transaction receipt string. (Optional, can be nil) @availability Available since 2.0.0 @attribute Note! This method cannot be called before initialize method has been triggered */ + (void)addBusinessEventWithCurrency:(NSString *)currency amount:(NSInteger)amount itemType:(NSString *)itemType itemId:(NSString *)itemId cartType:(NSString *)cartType receipt:(NSString *)receipt; /*! @method @abstract Add new business event @param currency Currency code in ISO 4217 format. (e.g. USD) @param amount (Integer) Amount in cents. (e.g. 99) @param itemType Item Type bought. (e.g. Gold Pack) @param itemId Item bought. (e.g. 1000 gold) @param autoFetchReceipt Should the SDK automatically fetch the transaction receipt and add it to the event @availability Available since 1.0.0 @attribute Note! This method cannot be called before initialize method has been triggered */ + (void)addBusinessEventWithCurrency:(NSString *)currency amount:(NSInteger)amount itemType:(NSString *)itemType itemId:(NSString *)itemId cartType:(NSString *)cartType autoFetchReceipt:(BOOL)autoFetchReceipt; /*! @method @abstract Add new resource event @param flowType Add or substract resource.
(See. GAResourceFlowType) @param currency One of the available currencies set in configureAvailableResourceCurrencies @param amount Amount sourced or sinked @param itemType One of the available item types set in configureAvailableResourceItemTypes @param itemId Item id (string max length=32) @availability Available since 2.0.0 @attribute Note! This method cannot be called before initialize method has been triggered */ + (void)addResourceEventWithFlowType:(GAResourceFlowType)flowType currency:(NSString *)currency amount:(NSNumber *)amount itemType:(NSString *)itemType itemId:(NSString *)itemId; /*! @method @abstract Add new progression event @param progressionStatus Status of added progression.
(See. GAProgressionStatus) @param progression01 1st progression (e.g. world01) @param progression02 2nd progression (e.g. level01) @param progression03 3rd progression (e.g. phase01) @availability Available since 1.0.0 @attribute Note! This method cannot be called before initialize method has been triggered */ + (void)addProgressionEventWithProgressionStatus:(GAProgressionStatus)progressionStatus progression01:(NSString *)progression01 progression02:(NSString *)progression02 progression03:(NSString *)progression03; /*! @method @abstract Add new progression event with score @param progressionStatus Status of added progression.
(See. GAProgressionStatus) @param progression01 1st progression (e.g. world01) @param progression02 2nd progression (e.g. level01) @param progression03 3rd progression (e.g. phase01) @availability Available since 2.0.0 @attribute Note! This method cannot be called before initialize method has been triggered */ + (void)addProgressionEventWithProgressionStatus:(GAProgressionStatus)progressionStatus progression01:(NSString *)progression01 progression02:(NSString *)progression02 progression03:(NSString *)progression03 score:(NSInteger)score; /*! @method @abstract Add new design event without a value @param eventId String can consist of 1 to 5 segments.
Segments are seperated by ':' and segments can have a max length of 32.
(e.g. segment1:anotherSegment:gold) @availability Available since 2.0.0 @attribute Note! This method cannot be called before initialize method has been triggered */ + (void)addDesignEventWithEventId:(NSString *)eventId; /*! @method @abstract Add new design event with a value @param eventId String can consist of 1 to 5 segments.
segments are seperated by ':' and segments can have a max length of 32.
(e.g. segment1:anotherSegment:gold) @param value Number value of event @availability Available since 2.0.0 @attribute Note! This method cannot be called before initialize method has been triggered */ + (void)addDesignEventWithEventId:(NSString *)eventId value:(NSNumber *)value; /*! @method @abstract Add new error event @param severity Severity of error (See. GAErrorSeverity) @param message Error message (Optional, can be nil) @availability Available since 2.0.0 @attribute Note! This method cannot be called before initialize method has been triggered */ + (void)addErrorEventWithSeverity:(GAErrorSeverity)severity message:(NSString *)message; /*! @method @abstract Add new ad event @param action Action of ad (See. GAAdAction) @param adType Type of ad (See. GAAdType) @param adSdkName Name of ad SDK @param adPlacement Placement of ad (ad identifier) @param duration Duration the user watched ad video @attribute Note! This method cannot be called before initialize method has been triggered */ + (void)addAdEventWithAction:(GAAdAction)action adType:(GAAdType)adType adSdkName:(NSString *)adSdkName adPlacement:(NSString *)adPlacement duration:(NSInteger)duration; /*! @method @abstract Add new ad event @param action Action of ad (See. GAAdAction) @param adType Type of ad (See. GAAdType) @param adSdkName Name of ad SDK @param adPlacement Placement of ad (ad identifier) @param noAdReason Error reason of ad @attribute Note! This method cannot be called before initialize method has been triggered */ + (void)addAdEventWithAction:(GAAdAction)action adType:(GAAdType)adType adSdkName:(NSString *)adSdkName adPlacement:(NSString *)adPlacement noAdReason:(GAAdError)noAdReason; /*! @method @abstract Add new ad event @param action Action of ad (See. GAAdAction) @param adType Type of ad (See. GAAdType) @param adSdkName Name of ad SDK @param adPlacement Placement of ad (ad identifier) @attribute Note! This method cannot be called before initialize method has been triggered */ + (void)addAdEventWithAction:(GAAdAction)action adType:(GAAdType)adType adSdkName:(NSString *)adSdkName adPlacement:(NSString *)adPlacement; /*! @method @abstract Add new mopub impression event @param impressionData Ad impression data @attribute Note! This method cannot be called before initialize method has been triggered */ + (void)addImpressionMopubEventWithImpressionData:(NSDictionary *)impressionData; /*! @method @abstract Add new impression event @param adNetworkName Name of ad network @param impressionData Ad impression data @attribute Note! This method cannot be called before initialize method has been triggered */ + (void)addImpressionEventWithAdNetworkName:(NSString *)adNetworkName impressionData:(NSDictionary *)impressionData; /*! @method @abstract Get remote configs value as string @param key The key declared in the webtool @availability Available since (TBD) @attribute Note! This method cannot be called before initialize method has been triggered */ + (NSString *)getRemoteConfigsValueAsString:(NSString*) key; /*! @method @abstract Get remote configs value as string @param key The key declared in the webtool @param defaultValue Fallback default value for when the method does not find a value under the specified key @availability Available since (TBD) @attribute Note! This method cannot be called before initialize method has been triggered */ + (NSString *) getRemoteConfigsValueAsString:(NSString *) key defaultValue:(NSString *)defaultValue; /*! @method @abstract Get remote configs configurations @availability Available since (TBD) @attribute For internal use. */ + (NSString *) getRemoteConfigsContentAsString; /*! @method @abstract Use this to set the delegate for the Remote Configs to retreive information about the status of loading configurations @availability Available since (TBD) */ + (void) setRemoteConfigsDelegate:(id)newDelegate; /*! @method @abstract Call for checking if remote configs values are loaded and ready @availability Available since (TBD) @attribute Note! This method should not be called before initialize method has been triggered */ + (BOOL) isRemoteConfigsReady; /*! @method @abstract Get A/B testing id @availability Available since (TBD) */ + (NSString *) getABTestingId; /*! @method @abstract Get A/B testing variant id @availability Available since (TBD) */ + (NSString *) getABTestingVariantId; /*! @method @abstract Enable info logging to console @param flag Enable or disable info log mode @availability Available since 2.0.0 */ + (void)setEnabledInfoLog:(BOOL)flag; /*! @method @abstract Enable verbose info logging of analytics. Will output event JSON data to console. @param flag Enable or disable verbose info log mode @availability Available since 2.0.0 */ + (void)setEnabledVerboseLog:(BOOL)flag; /*! @method @abstract Enable wanrning logging of analytics. @param flag Enable or disable watning log mode @availability Available since 3.2.1 */ + (void)setEnabledWarningLog:(BOOL)flag; /*! @method @abstract Enable manual session handling. This will disable the automatic session stop/start when the app goes to background/foreground and it is then needed to call endSession & startSession manually. Remember to call endSession when the app is going to background. The first session will always be started automatically when initialize is called. @param flag Enable or disable manual session handling. @availability Available since 2.2.2 */ + (void)setEnabledManualSessionHandling:(BOOL)flag; /*! @method @abstract Enable error reporting. When enabled this will automatic send error events for uncaught exceptions. @param flag Enable or disable error reporting. @availability Available since 3.1.0 */ + (void)setEnabledErrorReporting:(BOOL)flag; /*! @method @abstract Enable/disable event submission. When enabled this will allow events to be sent. @param flag Enable or disable event submission. @availability Available since 3.2.0 */ + (void)setEnabledEventSubmission:(BOOL)flag; /*! @method @abstract Start a new session. - if sdk is initialized - if manual session handling is enabled If a current session is currently active then it will end this session and start a new. @availability Available since 2.2.2 */ + (void)startSession; /*! @method @abstract End an active session. - if sdk is initialized - manual session handling is enabled - a session is active @availability Available since 2.2.2 */ + (void)endSession; /*! @method @abstract Set 1st custom dimension @param dimension01 One of the available dimension values set in configureAvailableCustomDimensions01
Will persist cross session. Set to nil to reset. @availability Available since 2.0.0 @attribute Note! Must be called after setAvailableCustomDimensions01WithCustomDimensions */ + (void)setCustomDimension01:(NSString *)dimension01; /*! @method @abstract Set 2nd custom dimension @param dimension02 One of the available dimension values set in configureAvailableCustomDimensions02
Will persist cross session. Set to nil to reset. @availability Available since 2.0.0 @attribute Note! Must be called after setAvailableCustomDimensions02 */ + (void)setCustomDimension02:(NSString *)dimension02; /*! @method @abstract Set 3rd custom dimension @param dimension03 One of the available dimension values set in configureAvailableCustomDimensions03
Will persist cross session. Set to nil to reset. @availability Available since 2.0.0 @attribute Note! Must be called after setAvailableCustomDimensions03W */ + (void)setCustomDimension03:(NSString *)dimension03; /*! @method @abstract Start timer for specified key @param key Key to use to relate to the timer */ + (void)startTimer:(NSString *)key; /*! @method @abstract Pause timer for specified key @param key Key to use to relate to the timer */ + (void)pauseTimer:(NSString *)key; /*! @method @abstract Resume timer for specified key @param key Key to use to relate to the timer */ + (void)resumeTimer:(NSString *)key; /*! @method @abstract Stop timer for specified key @param key Key to use to relate to the timer */ + (NSInteger)stopTimer:(NSString *)key; @end