AnalyticsSDK 0.2.1

AnalyticsSDK 0.2.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by EricShi.



 
Depends on:
UMengAnalytics~> 2.2.1
GoogleAnalytics-iOS-SDK~> 3.0.2
AVOSCloud>= 0
 

  • By
  • Eric

To be a full statistics SDK for all iOS statistics tools. For example, UMeng, 百度统计, Google Analytics

Support:

1. Umeng

  • 1, Default Channel : App Store

2. GoogleAnalytics

  • 1, Not support multi trackers
  • 2, Default Channel : App Store
  • 3, Default dispatch time interval 20 seconds
  • 4, Default Automatically send uncaught exceptions to Google Analytics
3. AVOS
  • 1.Default Channel : App Store
  • 2.Real time
  • 3.CrashReport
  • 4.Online channels set

Sample Code

  1. init AnalyticsSDK
- (void)initStatisticsSDK
{
  [AnalyticsSDK connectGoogleWithTrackingID:kAnalyticAppKeyGoogle];
  [AnalyticsSDK connectUmengWithAppKey:kAnalyticAppKeyUmeng];

  [AnalyticsSDK setLogEnabled:YES];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  // Override point for customization after application launch.
  [self initStatisticsSDK];

  return YES;
}
  1. Log some view
- (void)viewWillAppear:(BOOL)animated
{
  [super viewWillAppear:animated];

  [AnalyticsSDK beginLogView:NSStringFromClass([self class])];
}

- (void)viewWillDisappear:(BOOL)animated
{
  [super viewWillDisappear:animated];

  [AnalyticsSDK endLogView:NSStringFromClass([self class])];
}

For extend: automatic log view

#import "StatisticsViewController.h"

@interface SecondViewController : AnalyticsViewController

@end
  1. Events Support
- (IBAction)btnDidPressed:(id)sender
{
  [AnalyticsSDK eventWithCategory:@"First" action:@"Button" label:@"Pressed" value:nil];
  [AnalyticsSDK eventWithCategory:@"First" action:@"Button" label:@"Pressed" time:1000];
}

Notice:

  • 1, If you connect one item, and then you remove your connnection, there is an warnning.
  • 2, If you connect google analytics, If your app uses the CoreData framework : responding to a notification, e.g. NSManagedObjectContextDidSaveNotification, from the Google Analytics CoreData object may result in an exception. Instead, Apple recommends filtering CoreData notifications by specifying the managed object context as a parameter to your listener. Learn more from Apple.

Author

Eric, [email protected]

License

AnalyticsSDK is available under the MIT license. See the LICENSE file for more info.