Flurry iOS 4.2.3
 All Classes Functions Pages
Flurry Class Reference

Inherits NSObject.

Class Methods

(void) + startSession:
 Start a Flurry session for the project denoted by apiKey. More...
 
(void) + startSession:withOptions:
 Start a Flurry session for the project denoted by apiKey. More...
 
(void) + pauseBackgroundSession
 Pauses a Flurry session. More...
 
Pre-Session Calls

Optional sdk settings that should be called before start session.

(void) + setAppVersion:
 Explicitly specifies the App Version that Flurry will use to group Analytics data. More...
 
(NSString *) + getFlurryAgentVersion
 Retrieves the Flurry Agent Build Version. More...
 
(void) + setShowErrorInLogEnabled:
 Displays an exception in the debug log if thrown during a Session. More...
 
(void) + setDebugLogEnabled:
 Generates debug logs to console. More...
 
(void) + setLogLevel:
 Generates debug logs to console. More...
 
(void) + setSessionContinueSeconds:
 Set the timeout for expiring a Flurry session. More...
 
(void) + setSecureTransportEnabled:
 Send data over a secure transport. More...
 
(void) + setCrashReportingEnabled:
 Enable automatic collection of crash reports. More...
 
Event and Error Logging

Methods for reporting custom events and errors during the session.

(void) + logEvent:
 Records a custom event specified by eventName. More...
 
(void) + logEvent:withParameters:
 Records a custom parameterized event specified by eventName with parameters. More...
 
(void) + logError:message:exception:
 Records an app exception. Commonly used to catch unhandled exceptions. More...
 
(void) + logError:message:error:
 Records an app error. More...
 
(void) + logEvent:timed:
 Records a timed event specified by eventName. More...
 
(void) + logEvent:withParameters:timed:
 Records a custom parameterized timed event specified by eventName with parameters. More...
 
(void) + endTimedEvent:withParameters:
 Ends a timed event specified by eventName and optionally updates parameters with parameters. More...
 
Page View Methods

Count page views.

(void) + logAllPageViews:
 Automatically track page views on a UINavigationController or UITabBarController. More...
 
(void) + logPageView
 Explicitly track a page view during a session. More...
 
User Info

Methods to set user information.

(void) + setUserID:
 Assign a unique id for a user in your app. More...
 
(void) + setAge:
 Set your user's age in years. More...
 
(void) + setGender:
 Set your user's gender. More...
 
Location Reporting

Methods for setting location information.

(void) + setLatitude:longitude:horizontalAccuracy:verticalAccuracy:
 Set the location of the session. More...
 
Session Reporting Calls

Optional methods that can be called at any point to control session reporting.

(void) + setSessionReportsOnCloseEnabled:
 Set session to report when app closes. More...
 
(void) + setSessionReportsOnPauseEnabled:
 Set session to report when app is sent to the background. More...
 
(void) + setBackgroundSessionEnabled:
 Set session to support background execution. More...
 
(void) + setEventLoggingEnabled:
 Enable custom event logging. More...
 
(void) + setPushToken:
 Set device push token. More...
 

Method Documentation

+ (void) endTimedEvent: (NSString *)  eventName
withParameters: (NSDictionary *)  parameters 

Ends a timed event specified by eventName and optionally updates parameters with parameters.

Since
2.8.4

This method ends an existing timed event. If parameters are provided, this will overwrite existing parameters with the same name or create new parameters if the name does not exist in the parameter map set by logEvent:withParameters:timed:.

Note
You should not pass private or confidential information about your users in a custom event.
If the app is backgrounded prior to ending a timed event, the Flurry SDK will automatically end the timer on the event.
endTimedEvent:withParameters: is ignored if called on a previously terminated event.
See Also
+ logEvent:withParameters:timed: for details on starting a timed event with parameters.
- (void)startLevel
{
NSDictionary *params =
[NSDictionary dictionaryWithObjectsAndKeys:@"100", // Parameter Value
@"Current Points", // Parameter Name
nil];
[Flurry logEvent:@"Level Played" withParameters:params timed:YES];
// Start user on level
}
- (void)endLevel
{
// User gained additional 100 points in Level
NSDictionary *params =
[NSDictionary dictionaryWithObjectsAndKeys:@"200", // Parameter Value
@"Current Points", // Parameter Name
nil];
[Flurry endTimedEvent:@"Level Played" withParameters:params];
// User done with level
}
Parameters
eventNameName of the event. For maximum effectiveness, we recommend using a naming scheme that can be easily understood by non-technical people in your business domain.
parametersA map containing Name-Value pairs of parameters.
+ (NSString *) getFlurryAgentVersion

Retrieves the Flurry Agent Build Version.

Since
2.7

This is an optional method that retrieves the Flurry Agent Version and Build Version the app is running under. It is most often used if reporting an unexpected behavior of the SDK to Flurry Support

Note
This method must be called prior to invoking startSession:.
FAQ for the iPhone SDK is located at Support Center - iPhone FAQ.
See Also
+ setLogLevel: for information on how to view debugging information on your console.
Returns
The agent version of the Flurry SDK.
+ (void) logAllPageViews: (id)  target

Automatically track page views on a UINavigationController or UITabBarController.

Since
2.7

This method increments the page view count for a session based on traversing a UINavigationController or UITabBarController. The page view count is only a counter for the number of transitions in your app. It does not associate a name with the page count. To associate a name with a count of occurences see logEvent:.

Note
Please make sure you assign the Tab and Navigation controllers to the view controllers before passing them to this method.
See Also
+ logPageView for details on explictly incrementing page view count.
-(void) trackViewsFromTabBar:(UITabBarController*) tabBar
{
[Flurry logAllPageViews:tabBar];
}
Parameters
targetThe navigation or tab bar controller.
+ (void) logError: (NSString *)  errorID
message: (NSString *)  message
error: (NSError *)  error 

Records an app error.

Since
2.7

This method captures an error for reporting to Flurry.

See Also
+ logError:message:exception: for details on capturing exceptions.
- (void) webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
[Flurry logError:@"WebView No Load" message:[error localizedDescription] error:error];
}
Parameters
errorIDName of the error.
messageThe message to associate with the error.
errorThe error object to report.
+ (void) logError: (NSString *)  errorID
message: (NSString *)  message
exception: (NSException *)  exception 

Records an app exception. Commonly used to catch unhandled exceptions.

Since
2.7

This method captures an exception for reporting to Flurry. We recommend adding an uncaught exception listener to capture any exceptions that occur during usage that is not anticipated by your app.

See Also
+ logError:message:error: for details on capturing errors.
- (void) uncaughtExceptionHandler(NSException *exception)
{
[Flurry logError:@"Uncaught" message:@"Crash!" exception:exception];
}
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
[Flurry startSession:@"YOUR_API_KEY"];
// ....
}
Parameters
errorIDName of the error.
messageThe message to associate with the error.
exceptionThe exception object to report.
+ (void) logEvent: (NSString *)  eventName

Records a custom event specified by eventName.

Since
2.8.4

This method allows you to specify custom events within your app. As a general rule you should capture events related to user navigation within your app, any action around monetization, and other events as they are applicable to tracking progress towards your business goals.

Note
You should not pass private or confidential information about your users in a custom event.
Where applicable, you should make a concerted effort to use timed events with parameters (logEvent:withParameters:timed:) or events with parameters (logEvent:withParameters:). This provides valuable information around the time the user spends within an action (e.g. - time spent on a level or viewing a page) or characteristics of an action (e.g. - Buy Event that has a Parameter of Widget with Value Golden Sword).
See Also
+ logEvent:withParameters: for details on storing events with parameters.
+ logEvent:timed: for details on storing timed events.
+ logEvent:withParameters:timed: for details on storing timed events with parameters.
+ endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating parameters.
- (void)interestingAppAction
{
[Flurry logEvent:@"Interesting_Action"];
// Perform interesting action
}
Parameters
eventNameName of the event. For maximum effectiveness, we recommend using a naming scheme that can be easily understood by non-technical people in your business domain.
+ (void) logEvent: (NSString *)  eventName
timed: (BOOL)  timed 

Records a timed event specified by eventName.

Since
2.8.4

This method overrides #logEvent to allow you to capture the length of an event. This can be extremely valuable to understand the level of engagement with a particular action. For example, you can capture how long a user spends on a level or reading an article.

Note
You should not pass private or confidential information about your users in a custom event.
Where applicable, you should make a concerted effort to use parameters with your timed events (logEvent:withParameters:timed:). This provides valuable information around the characteristics of an action (e.g. - Buy Event that has a Parameter of Widget with Value Golden Sword).
See Also
+ logEvent:withParameters:timed: for details on storing timed events with parameters.
+ endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating parameters.
- (void)startLevel
{
[Flurry logEvent:@"Level Played" timed:YES];
// Start user on level
}
- (void)endLevel
{
[Flurry endTimedEvent:@"Level Played" withParameters:nil];
// User done with level
}
Parameters
eventNameName of the event. For maximum effectiveness, we recommend using a naming scheme that can be easily understood by non-technical people in your business domain.
timedSpecifies the event will be timed.
+ (void) logEvent: (NSString *)  eventName
withParameters: (NSDictionary *)  parameters 

Records a custom parameterized event specified by eventName with parameters.

Since
2.8.4

This method overrides #logEvent to allow you to associate parameters with an event. Parameters are extremely valuable as they allow you to store characteristics of an action. For example, if a user purchased an item it may be helpful to know what level that user was on. By setting this parameter you will be able to view a distribution of levels for the purcahsed event on the Flurrly Dev Portal.

Note
You should not pass private or confidential information about your users in a custom event.
A maximum of 10 parameter names may be associated with any event. Sending over 10 parameter names with a single event will result in no parameters being logged for that event. You may specify an infinite number of Parameter values. For example, a Search Box would have 1 parameter name (e.g. - Search Box) and many values, which would allow you to see what values users look for the most in your app.
Where applicable, you should make a concerted effort to use timed events with parameters (logEvent:withParameters:timed:). This provides valuable information around the time the user spends within an action (e.g. - time spent on a level or viewing a page).
See Also
+ logEvent:withParameters:timed: for details on storing timed events with parameters.
+ endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating parameters.
- (void)userPurchasedSomethingCool
{
NSDictionary *params =
[NSDictionary dictionaryWithObjectsAndKeys:@"Cool Item", // Parameter Value
@"Item Purchased", // Parameter Name
nil];
[Flurry logEvent:@"Something Cool Purchased" withParameters:params];
// Give user cool item
}
Parameters
eventNameName of the event. For maximum effectiveness, we recommend using a naming scheme that can be easily understood by non-technical people in your business domain.
parametersA map containing Name-Value pairs of parameters.
+ (void) logEvent: (NSString *)  eventName
withParameters: (NSDictionary *)  parameters
timed: (BOOL)  timed 

Records a custom parameterized timed event specified by eventName with parameters.

Since
2.8.4

This method overrides #logEvent to allow you to capture the length of an event with parameters. This can be extremely valuable to understand the level of engagement with a particular action and the characteristics associated with that action. For example, you can capture how long a user spends on a level or reading an article. Parameters can be used to capture, for example, the author of an article or if something was purchased while on the level.

Note
You should not pass private or confidential information about your users in a custom event.
See Also
+ endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating parameters.
- (void)startLevel
{
NSDictionary *params =
[NSDictionary dictionaryWithObjectsAndKeys:@"100", // Parameter Value
@"Current Points", // Parameter Name
nil];
[Flurry logEvent:@"Level Played" withParameters:params timed:YES];
// Start user on level
}
- (void)endLevel
{
// User gained additional 100 points in Level
NSDictionary *params =
[NSDictionary dictionaryWithObjectsAndKeys:@"200", // Parameter Value
@"Current Points", // Parameter Name
nil];
[Flurry endTimedEvent:@"Level Played" withParameters:params];
// User done with level
}
Parameters
eventNameName of the event. For maximum effectiveness, we recommend using a naming scheme that can be easily understood by non-technical people in your business domain.
parametersA map containing Name-Value pairs of parameters.
timedSpecifies the event will be timed.
+ (void) logPageView

Explicitly track a page view during a session.

Since
2.7

This method increments the page view count for a session when invoked. It does not associate a name with the page count. To associate a name with a count of occurences see logEvent:.

See Also
#logAllPageViews for details on automatically incrementing page view count based on user traversing navigation or tab bar controller.
-(void) trackView
{
}
+ (void) pauseBackgroundSession

Pauses a Flurry session.

Since
4.2.2

This method is useful in case of setBackgroundSessionEnabled: set to YES. It can be called when application finished all background tasks (such as playing music) to pause session. If the app is resumed before time specified in setSessionContinueSeconds:, the session will continue, otherwise a new session will begin.

See Also
+ setSessionContinueSeconds: for details on setting a custom session timeout.
+ setBackgroundSessionEnabled: for details on setting a custom behaviour on resigning activity.
- (void)allBackgroundTasksFinished
{
// ....
// ....
}
+ (void) setAge: (int)  age

Set your user's age in years.

Since
2.7

Use this method to capture the age of your user. Only use this method if you collect this information explictly from your user (i.e. - there is no need to set a default value).

Note
The age is aggregated across all users of your app and not available on a per user basis.
Parameters
ageReported age of user.
+ (void) setAppVersion: (NSString *)  version

Explicitly specifies the App Version that Flurry will use to group Analytics data.

Since
2.7

This is an optional method that overrides the App Version Flurry uses for reporting. Flurry will use the CFBundleVersion in your info.plist file when this method is not invoked.

Note
There is a maximum of 605 versions allowed for a single app.
This method must be called prior to invoking startSession:.
Parameters
versionThe custom version name.
+ (void) setBackgroundSessionEnabled: (BOOL)  setBackgroundSessionEnabled

Set session to support background execution.

Since
4.2.2

Use this method finish session data when the app is paused. The default value is taken looking at the UIBackgroundModes of application's Info.plist. If UIBackgroundModes array is empty, equals NO, otherwise YES.

Parameters
setBackgroundSessionEnabledNO to finish on resigning active, YES to omit finishing.
+ (void) setCrashReportingEnabled: (BOOL)  value

Enable automatic collection of crash reports.

Since
4.1

This is an optional method that collects crash reports when enabled. The default value is NO.

Note
This method must be called prior to invoking startSession:.
Parameters
valueYES to enable collection of crash reports.
+ (void) setDebugLogEnabled: (BOOL)  value

Generates debug logs to console.

Since
2.7

This is an optional method that displays debug information related to the Flurry SDK. display information to the console. The default setting for this method is NO which sets the log level to FlurryLogLevelCriticalOnly. When set to YES the debug log level is set to FlurryLogLevelDebug

Note
This method must be called prior to invoking startSession:. If the method, setLogLevel is called later in the code, debug logging will be automatically enabled.
Parameters
valueYES to show debug logs, NO to omit debug logs.
+ (void) setEventLoggingEnabled: (BOOL)  value

Enable custom event logging.

Since
2.7

Use this method to allow the capture of custom events. The default value is YES.

Parameters
valueYES to enable event logging, NO to stop custom logging.
+ (void) setGender: (NSString *)  gender

Set your user's gender.

Since
2.7

Use this method to capture the gender of your user. Only use this method if you collect this information explictly from your user (i.e. - there is no need to set a default value). Allowable values are "m" or @c @"f"

Note
The gender is aggregated across all users of your app and not available on a per user basis.
Parameters
genderReported gender of user.
+ (void) setLatitude: (double)  latitude
longitude: (double)  longitude
horizontalAccuracy: (float)  horizontalAccuracy
verticalAccuracy: (float)  verticalAccuracy 

Set the location of the session.

Since
2.7

Use information from the CLLocationManager to specify the location of the session. Flurry does not automatically track this information or include the CLLocation framework.

Note
Only the last location entered is captured per session.
Regardless of accuracy specified, the Flurry SDK will only report location at city level or higher.
Location is aggregated across all users of your app and not available on a per user basis.
This information should only be captured if it is germaine to the use of your app.
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
[locationManager startUpdatingLocation];

After starting the location manager, you can set the location with Flurry. You can implement CLLocationManagerDelegate to be aware of when the location is updated. Below is an example of how to use this method, after you have recieved a location update from the locationManager.

CLLocation *location = locationManager.location;
[Flurry setLatitude:location.coordinate.latitude
longitude:location.coordinate.longitude
horizontalAccuracy:location.horizontalAccuracy
verticalAccuracy:location.verticalAccuracy];
Parameters
latitudeThe latitude.
longitudeThe longitude.
horizontalAccuracyThe radius of uncertainty for the location in meters.
verticalAccuracyThe accuracy of the altitude value in meters.
+ (void) setLogLevel: (FlurryLogLevel)  value

Generates debug logs to console.

Since
4.2.2

This is an optional method that displays debug information related to the Flurry SDK. display information to the console. The default setting for this method is FlurryLogLevelCritycalOnly.

Note
Its good practice to call this method prior to invoking startSession:. If debug logging is disabled earlier, this method will enable it.
Parameters
valueLog level
+ (void) setPushToken: (NSString *)  pushToken

Set device push token.

Since
2.7

After the device has successfully registered with APNS, call this method to set the push token received from APNS.

+ (void) setSecureTransportEnabled: (BOOL)  value

Send data over a secure transport.

Since
3.0

This is an optional method that sends data over an SSL connection when enabled. The default value is NO.

Note
This method must be called prior to invoking startSession:.
Parameters
valueYES to send data over secure connection.
+ (void) setSessionContinueSeconds: (int)  seconds

Set the timeout for expiring a Flurry session.

Since
2.7

This is an optional method that sets the time the app may be in the background before starting a new session upon resume. The default value for the session timeout is 10 seconds in the background.

Note
This method must be called prior to invoking startSession:.
Parameters
secondsThe time in seconds to set the session timeout to.
+ (void) setSessionReportsOnCloseEnabled: (BOOL)  sendSessionReportsOnClose

Set session to report when app closes.

Since
2.7

Use this method report session data when the app is closed. The default value is YES.

Note
This method is rarely invoked in iOS >= 3.2 due to the updated iOS lifecycle.
See Also
+ setSessionReportsOnPauseEnabled:
Parameters
sendSessionReportsOnCloseYES to send on close, NO to omit reporting on close.
+ (void) setSessionReportsOnPauseEnabled: (BOOL)  setSessionReportsOnPauseEnabled

Set session to report when app is sent to the background.

Since
2.7

Use this method report session data when the app is paused. The default value is YES.

Parameters
setSessionReportsOnPauseEnabledYES to send on pause, NO to omit reporting on pause.
+ (void) setShowErrorInLogEnabled: (BOOL)  value

Displays an exception in the debug log if thrown during a Session.

Since
2.7

This is an optional method that augments the debug logs with exceptions that occur during the session. You must both capture exceptions to Flurry and set debug logging to enabled for this method to display information to the console. The default setting for this method is NO.

Note
This method must be called prior to invoking startSession:.
See Also
+ setLogLevel: for information on how to view debugging information on your console.
+ logError:message:exception: for details on logging exceptions.
+ logError:message:error: for details on logging errors.
Parameters
valueYES to show errors in debug logs, NO to omit errors in debug logs.
+ (void) setUserID: (NSString *)  userID

Assign a unique id for a user in your app.

Since
2.7
Note
Please be sure not to use this method to pass any private or confidential information about the user.
Parameters
userIDThe app id for a user.
+ (void) startSession: (NSString *)  apiKey

Start a Flurry session for the project denoted by apiKey.

Since
2.6

This method serves as the entry point to Flurry Analytics collection. It must be called in the scope of applicationDidFinishLaunching. The session will continue for the period the app is in the foreground until your app is backgrounded for the time specified in setSessionContinueSeconds:. If the app is resumed in that period the session will continue, otherwise a new session will begin.

Crash reporting will not be enabled. See setCrashReportingEnabled: for more information.

Note
If testing on a simulator, please be sure to send App to background via home button. Flurry depends on the iOS lifecycle to be complete for full reporting.
See Also
+ setSessionContinueSeconds: for details on setting a custom session timeout.
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
// Optional Flurry startup methods
[Flurry startSession:@"YOUR_API_KEY"];
// ....
}
Parameters
apiKeyThe API key for this project.
+ (void) startSession: (NSString *)  apiKey
withOptions: (id)  options 

Start a Flurry session for the project denoted by apiKey.

Since
4.0.8

This method serves as the entry point to Flurry Analytics collection. It must be called in the scope of applicationDidFinishLaunching passing in the launchOptions param. The session will continue for the period the app is in the foreground until your app is backgrounded for the time specified in setSessionContinueSeconds:. If the app is resumed in that period the session will continue, otherwise a new session will begin.

Note
If testing on a simulator, please be sure to send App to background via home button. Flurry depends on the iOS lifecycle to be complete for full reporting.
See Also
+ setSessionContinueSeconds: for details on setting a custom session timeout.
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Optional Flurry startup methods
[Flurry startSession:@"YOUR_API_KEY" withOptions:launchOptions];
// ....
}
Parameters
apiKeyThe API key for this project.
optionspassed launchOptions from the applicatin's didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

The documentation for this class was generated from the following file: