CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jan 2015 |
Maintained by Masashi Ono.
This small library enables automatic session management for Google Analytics (GAI) for iOS version 3. Automatic session management feature is supported in the prior version of GAI for iOS and the latest version of GAI for Android, but somehow only GAI for iOS version 3 doesn't. For more information, refer the following documents:
You need to install GAI for iOS 3 SDK to your project before use. Refer the following documentation to learn how to install the SDK: https://developers.google.com/analytics/devguides/collection/ios/v3/
After you install the SDK,
Classes
folder to your project.Then all you have to do is:
GAI+AutomaticSessionManagement.h
ASM_setDefaultTracker:
ASM_startAutomaticSessionManagement
That's it. Here's a short example:
#import "AppDelegate.h"
#import "GAI+AutomaticSessionManagement.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// GAI+AutomaticSessionManagement requires the default tracker to be set before use.
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"MY-TRACKING-ID"];
// Make sure to use ASM_setDefaultTracker when setting the default tracker!
[[GAI sharedInstance] ASM_setDefaultTracker:tracker];
// Begin automatic session management.
[[GAI sharedInstance] ASM_startAutomaticSessionManagement];
/*... Your Code ...*/
}
Note that only sessions tracked by the default tracker will be managed automatically. If you have other trackers, this library won't do anything automatically to those trackers.
Tested under iOS SDK version 7 and Xcode 5.0.2. Runs on iOS 5.0.0 or above.