Introduction
The Flurry Analytics Agent allows you to track the usage and
behavior of your application on users' phones for viewing in the Flurry Analytics system.
behavior of your application on users' phones for viewing in the Flurry Analytics system.
Note
1. Flurry SDK will only work with Xcode 3.2.5 or above. If you need an SDK for an
older Xcode version please email support.
older Xcode version please email support.
2. Flurry Agent does not require CoreLocation framework and will not collect GPS
location by default. Developers who use their own
location by default. Developers who use their own
CLLocationManager can set GPS location information in the Flurry Agent
(see Optional Features for more information).
(see Optional Features for more information).
Integration
1. In the finder, drag FlurryLib into project's file folder. (NOTE: If you are upgrading
the Flurry iPad SDK, be sure to remove any existing Flurry library folders from your
project's file folder before proceeding.)
the Flurry iPad SDK, be sure to remove any existing Flurry library folders from your
project's file folder before proceeding.)
2. Now add it to your project: Project > Add to project > FlurryLib - Choose
'Recursively create groups for any added folders'
'Recursively create groups for any added folders'
3. In your Application Delegate:
a. Import FlurryAPI: #import "FlurryAPI.h"
b. Inside "applicationDidFinishLaunching:" add: [FlurryAPI startSession:@"YOUR_API_KEY"];
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[FlurryAPI startSession:@"YOUR_API_KEY"];
//your code
}
}
Features
a) Tracking user Behavior
[FlurryAPI logEvent:@"EVENT_NAME"];
Use logEvent to count the number of times certain events happen during a session of
your application. This can be useful for measuring how often users perform various
actions, for example. Your application is currently limited to counting occurrences for
300 different event ids (maximum length 255 characters).
your application. This can be useful for measuring how often users perform various
actions, for example. Your application is currently limited to counting occurrences for
300 different event ids (maximum length 255 characters).
[FlurryAPI logEvent:@"EVENT_NAME" withParameters:YOUR_NSDictionary];
Use this version of logEvent to count the number of times certain events happen during
a session of your application and to pass dynamic parameters to be recorded with that
event. Event parameters can be passed in as a NSDictionary object where the key and
value objects must be NSString objects. For example, you could record that a user used
your search box tool and also dynamically record which search terms the user entered.
Your application is currently limited to counting occurrences for 300 different event ids
(maximum length 255 characters). Maximum of 10 event parameters per
event is supported.
a session of your application and to pass dynamic parameters to be recorded with that
event. Event parameters can be passed in as a NSDictionary object where the key and
value objects must be NSString objects. For example, you could record that a user used
your search box tool and also dynamically record which search terms the user entered.
Your application is currently limited to counting occurrences for 300 different event ids
(maximum length 255 characters). Maximum of 10 event parameters per
event is supported.
[FlurryAPI logEvent:@"EVENT_NAME" timed:YES];
Use this version of logEvent to start timed event.
[FlurryAPI logEvent:@"EVENT_NAME" withParameters:YOUR_NSDictionary
timed:YES];
timed:YES];
Use this version of logEvent to start timed event with event parameters.
[FlurryAPI endTimedEvent:@"EVENT_NAME" withParameters:
YOUR_NSDictionary];
YOUR_NSDictionary];
Use endTimedEvent to end timed event before app exists, otherwise timed events
automatically end when app exists. When ending the timed event, a new event
parameters NSDictionary object can be used to update event parameters.
To keep event parameters the same, pass in nil for the event parameters NSDictionary
object.
automatically end when app exists. When ending the timed event, a new event
parameters NSDictionary object can be used to update event parameters.
To keep event parameters the same, pass in nil for the event parameters NSDictionary
object.
[FlurryAPI logAllPageViews:navigationController];
To enable Flurry agent to automatically detect and log page view, pass in an
instance of UINavigationController or UITabBarController to countPageViews.
Flurry agent will create a delegate on your object to detect user interactions.
Each detected user interaction will automatically be logged as a page view.
Each instance needs to only be passed to Flurry agent once. Multiple
UINavigationController or UITabBarController instances can be passed to Flurry agent.
instance of UINavigationController or UITabBarController to countPageViews.
Flurry agent will create a delegate on your object to detect user interactions.
Each detected user interaction will automatically be logged as a page view.
Each instance needs to only be passed to Flurry agent once. Multiple
UINavigationController or UITabBarController instances can be passed to Flurry agent.
[FlurryAPI logPageView];
In the absence of UINavigationController and UITabBarController, you can
manually detect user interactions. For each user interaction you want to manually log,
you can use logPageView to log the page view.
manually detect user interactions. For each user interaction you want to manually log,
you can use logPageView to log the page view.
b) Tracking Application Errors
[FlurryAPI logError:@"ERROR_NAME" message:@"ERROR_MESSAGE"
exception:e];
exception:e];
Use this to log exceptions and/or errors that occur in your app. Flurry will report the
first 10 errors that occur in each session.
first 10 errors that occur in each session.
c) Tracking Demographics
[FlurryAPI setUserID:@"USER_ID"];
Use this to log the user's assigned ID or username in your system after identifying
the user.
the user.
[FlurryAPI setAge:21];
Use this to log the user's age after identifying the user. Valid inputs are 0 or greater.
[FlurryAPI setGender:@"m"];
Use this to log the user's gender after identifying the user. Valid inputs are m (male)
or f (female)
or f (female)
d) Tracking Location
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
[locationManager startUpdatingLocation]
[locationManager startUpdatingLocation]
CLLocation *location = locationManager.location; [FlurryAPI setLatitude:
location.coordinate.latitude
location.coordinate.latitude
longitude:location.coordinate.longitude horizontalAccuracy:location
.horizontalAccuracy verticalAccuracy:location.verticalAccuracy];
.horizontalAccuracy verticalAccuracy:location.verticalAccuracy];
This allows you to set the current GPS location of the user. Flurry will keep only
the last location information. If your app does not use location services in a meaningful
way, using CLLocationManager can result in Apple rejecting the app submission.
the last location information. If your app does not use location services in a meaningful
way, using CLLocationManager can result in Apple rejecting the app submission.
e) Controlling Data Reporting
[FlurryAPI setSessionReportsOnCloseEnabled:(BOOL)sendSessionReportsOnClose];
This option is on by default. When enabled, Flurry will attempt to send session data
when the app is exited as well as it normally does when the app is started.
This will improve the speed at which your application analytics are updated
but can prolong the app termination process due to network latency.
In some cases, the network latency can cause the app to crash.
when the app is exited as well as it normally does when the app is started.
This will improve the speed at which your application analytics are updated
but can prolong the app termination process due to network latency.
In some cases, the network latency can cause the app to crash.
[FlurryAPI setSessionReportsOnPauseEnabled:(BOOL)sendSessionReportsOnPause];
This option is on by default. When enabled, Flurry will attempt to send session
data when the app is paused as well as it normally does when the app is started.
This will improve the speed at which your application analytics are updated
but can prolong the app pause process due to network latency.
In some cases, the network latency can cause the app to crash.
data when the app is paused as well as it normally does when the app is started.
This will improve the speed at which your application analytics are updated
but can prolong the app pause process due to network latency.
In some cases, the network latency can cause the app to crash.