%3Aquality(100)&w=3840&q=75)
BLACKBERRY DEVELOPERS
Get Started with BlackBerry Analytics SDK for iOS
Integrate BlackBerry Analytics into iOS Dynamics apps with prerequisites, entitlements, and SDK setup guidance.
Before you begin: BlackBerry Analytics can only be integrated with BlackBerry Dynamics apps. For more information on BlackBerry Dynamics apps , see Getting Started with BlackBerry Dynamics SDK.
Go to the downloads page to download the BlackBerry Analytics SDK for Android or iOS.
Complete the following steps to verify that you are entitled to the BlackBerry Analytics app:
Log in to the BlackBerry UEM management console.
Click Apps.
Search for BlackBerry Analytics.
If you are entitled to use BlackBerry Analytics, the BlackBerry Analytics app appears in the app list. If you do not see the BlackBerry Analytics app in the app list, you must contact your BlackBerry representative to request entitlement.
%3Aquality(100)&w=3840&q=75)
Install and Configure
1. In the UEM management console, click Users and select the user.
%3Aquality(100)&w=3840&q=75)
2. In the Apps section, click the plus icon.
3. Search for and select the BlackBerry Analytics entitlement.
%3Aquality(100)&w=3840&q=75)
4. Click Next.
5. In the Disposition drop-down list, select Required.
6. Click Assign.
Develop and Deploy
Unzip the BlackBerry Analytics framework.
Under the Build Phases of the application target, add BAFBlackberryAnalytics.framework to the Link Binary with Libraries phase.
Under the Other Linker Flags build setting of the project, add
-lstdc++ -lz –ObjC.In AppDelegate, import Analytics.
Obj-C
#import <BAFBlackberryAnalytics/BAFBlackberryAnalytics.hSwift
import BAFBlackberryAnalyticsInitialize the SDK in the didfinishlaunchingwithoptions method.
Obj-C
[BAFBlackberryAnalytics setStage];Swift
BAFBlackberryAnalytics.setStage();Relay BlackBerry Dynamics events to the BlackBerry Analytics engine by adding this code to the handleEvent method.
Obj-C[BAFBlackberryAnalytics sendGDAppEvent:anEvent];Swift
BAFBlackberryAnalytics.sendGDAppEvent(anEvent)
It takes 24 hours for the data to be updated on the BlackBerry Analytics Dashboard.
%3Aquality(100)&w=3840&q=75)
Custom Events
The BlackBerry Analytics Library introduces two APIs to track custom events in apps.
The following events are provided to use with APIs to track metrics.
Paired Events(Feature Active/Inactive) : These events provide the time slices to track the start/open or end/close events of specific task/feature.
Single Events (Adoption Event): This event uniquely represents a specific event/task that should be tracked in the portal.
Feature Active and Feature Inactive events are confined to the visible life cycle of the app. When the app moves to the background, the BlackBerry Analytics SDK marks all of the current active features as inactive features. Features that were active prior to the app going to the background will no longer be tracked as active features after the app moves to the foreground. The app will have to mark a feature as active when it is in the foreground again. Also, apps may need to call the trackFeatureEvent API to record Feature Inactive events when the apps view/screen is switched to different view/screen.
If the app calls the trackFeatureEvent API to record a Feature Inactive event after the app enters background, the BAFFeaturetNotFound response is returned.
Event Type | iOS (BAFAnalyticsEvent) | Description |
FeatureActive | BAFFeatureActive | To record feature active event |
FeatureInactive | BAFFeatureInactive | To record feature inactive event |
AdoptionEvent | BAFAdoptionEvent | To record adoption event. |
These events can be done with the following code.
Obj-C
[BAFBlackberryAnalytics trackFeatureEvent:BAFFeatureActivewithFeatureName:@"EventName" completion:^(NSError *error) { NSLog(@"%@",[error localizedDescription]); }];[BAFBlackberryAnalytics trackFeatureEvent:BAFFeatureInactivewithFeatureName:@"EventName" completion:^(NSError *error) { NSLog(@"%@",[error localizedDescription]); }];[BAFBlackberryAnalytics trackApplicationEvent:BAFAdoptionEvent withValue:@"Value"forKey:@"Key" completion:^(NSError *error) { NSLog(@"%@",[error localizedDescription]); }];
Swift
BAFBlackberryAnalytics.trackApplicationEvent(.adoptionEvent, withValue: "Value", forKey:"Key", completion: { (error) in }) BAFBlackberryAnalytics.trackFeatureEvent(.featureActive, withFeatureName:"EventName", completion: { (error) in }) BAFBlackberryAnalytics.trackFeatureEvent(.featureInactive, withFeatureName:"EventName", completion: { (error) in })
You can see custom events under Feature Tracking tab when you select your app under Apps on the left navigation bar.
%3Aquality(100)&w=3840&q=75)
Congratulations on adding BlackBerry Analytics to your secure app!