Flurry Analytics
This plugin connects to Flurry Analytics SDK
Repo: https://github.com/blakgeek/cordova-plugin-flurryanalytics
Installation
- Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add cordova-plugin-flurryanalytics $ npm install --save @ionic-native/flurry-analytics@4
- Add this plugin to your app's module
Supported platforms
- Android
- iOS
Usage
import { FlurryAnalytics, FlurryAnalyticsObject, FlurryAnalyticsOptions } from '@ionic-native/flurry-analytics';
constructor(private flurryAnalytics: FlurryAnalytics) { }
...
const options: FlurryAnalyticsOptions = {
appKey: '<your app key>', // REQUIRED
reportSessionsOnClose: true,
enableLogging: true
};
let fa: FlurryAnalyticsObject = this.flurryAnalytics.create(options);
fa.logEvent('event name')
.then(() => console.log('Logged an event!'))
.catch(e => console.log('Error logging the event', e));
Instance Members
create(options)
Creates a new instance of FlurryAnalyticsObject
Param | Type | Details |
---|---|---|
options |
FlurryAnalyticsOptions
|
Options |
Returns: FlurryAnalyticsObject
FlurryAnalyticsObject
Instance Members
logEvent(eventName, params)
This function set the Event
Param | Type | Details |
---|---|---|
eventName |
string
|
Name of the event |
params |
Object
|
Optional params |
Returns: Promise<any>
Returns a promise that resolves when event is sent
startTimedEvent(eventName, Optional)
Start a timed event
Param | Type | Details |
---|---|---|
eventName |
string
|
Name of the event |
Optional |
Object
|
params |
Returns: Promise<any>
Returns a promise that resolves when timed event is started tracking
endTimedEvent(eventName, params)
Complete a timed event
Param | Type | Details |
---|---|---|
eventName |
string
|
Name of the event |
params |
Object
|
Optional params |
Returns: Promise<any>
Returns a promise that resolves when timed event is ended tracking
logError(code, message)
This function log an error
Param | Type | Details |
---|---|---|
code |
Object
|
|
message |
Object
|
Returns: Promise<any>
logPageView()
This function log a page view
Returns: Promise<any>
setLocation(location, message)
This function set the location for the event (this is will only be used for very course grained statistics like city)
Param | Type | Details |
---|---|---|
location |
FlurryAnalyticsLocation
|
|
message |
string
|
Returns: Promise<any>
startSession()
This function start the session Only needed for older versions of Android
Returns: Promise<any>
endSession()
This function end the session Only needed for older versions of Android
Returns: Promise<any>
FlurryAnalyticsOptions
Param | Type | Details |
---|---|---|
appKey |
string
|
Flurry API key is required |
version |
string
|
Overrides the version of the app (optional) |
continueSessionSeconds |
number
|
How long can the app be paused before a new session is created, must be less than or equal to five for Android devices (optional) |
userId |
string
|
Set id of the user (optional) |
gender |
string
|
Set gender of the user Valid values are "m", "M", "f" and "F" (optional) |
age |
number
|
Set age of the user (optional) |
logLevel |
string
|
Set error for log Values: VERBOSE, DEBUG, INFO, WARN, ERROR (optional) |
enableLogging |
boolean
|
Defaults to false (optional) |
enableEventLogging |
boolean
|
Should every event show up the app's log, defaults to true (optional) |
enableCrashReporting |
boolean
|
Should app crashes be recorded in flurry, defaults to false, iOS only (optional) |
enableBackgroundSessions |
boolean
|
Should the session continue when the app is the background, defaults to false, iOS only (optional) |
reportSessionsOnClose |
boolean
|
Should data be pushed to flurry when the app closes, defaults to true, iOS only (optional) |
reportSessionsOnPause |
boolean
|
Should data be pushed to flurry when the app is paused, defaults to true, iOS only (optional) |
FlurryAnalyticsLocation
Param | Type | Details |
---|---|---|
latitude |
number
|
|
longitude |
number
|
|
verticalAccuracy |
number
|
Set altitude It is optional and use only for iOS (optional) |
horizontalAccuracy |
number
|
Set radius about 2d point It is optional and use only for iOS (optional) |