测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可 | MIT |
发布最后发布 | 2015年5月 |
由Bruno Tortato Furtado维护。
依赖项 | |
GoogleAnalytics-iOS-SDK | >= 0 |
NZBundle | >= 0 |
快速简单地将Google Analytics API集成到iOS中。
NZGoogleAnalytics适用于iOS 5.0及以上版本,并与ARC项目兼容。它依赖于以下Apple框架,这些框架通常包含在大多数Xcode模板中:
为了构建NZGoogleAnalytics,您需要LLVM 3.0或更高版本。
NZGoogleAnalytics使用Google Analytics SDK for iOS 和 NZBundle。
你也可以直接将源文件添加到项目中。
NZGoogleAnalytics
文件夹拖放到项目中(使用"Product Navigator view")。如果在项目外解压了代码归档,确保选择"Copy items"。调试/发布模式的默认值
trackUncaughtExceptions
: NOdispatchInterval
: 5秒logLevel
: kGAILogLevelNone发布模式的默认值
trackUncaughtExceptions
: YESdispatchInterval
: 20秒logLevel
: kGAILogLevelNoneNZGoogleAnalytics使用NZBundle来更改构建版本名称
X.X.Xa alpha
X.X.Xa
trackingID
...
#import "NZGoogleAnalytics.h"
@implementation NZAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[NZGoogleAnalytics setTrackingId:@"UA-000000-01"];
return YES;
}
@end
NZGoogleAnalytics覆盖了NSObject类中的+(void)load;
方法,该方法在每次应用程序启动时都会被调用。
你可以更改默认设置
#import "NZGoogleAnalytics.h"
...
[NZGoogleAnalytics setTrackUncaughtExceptions:YES];
BOOL trackUncaughtExceptions = [NZGoogleAnalytics trackUncaughtExceptions];
[NZGoogleAnalytics setDispatchInterval:60];
NSTimeInterval dispatchInterval = [NZGoogleAnalytics dispatchInterval];
[NZGoogleAnalytics setLogLevel:kGAILogLevelError];
GAILogLevel logLevel = [NZGoogleAnalytics logLevel];
轻松跟踪你的View Controller
NZGoogleAnalytics-Tracker.plist
添加到你的项目中class_name
: 你的view controller类名view_name
:您的跟踪视图名称#import "NZGoogleAnalyticsTracker.h"
...
// screen name: /ios/first_view
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[NZGoogleAnalyticsTracker trackViewWithController:self];
}
#import "NZGoogleAnalyticsTracker.h"
...
// screen name: /ios/first_view/id_001
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[NZGoogleAnalyticsTracker trackViewWithController:self withIdentifier:@"id_001"];
}
- (IBOutlet)buttonClicked
{
[NZGoogleAnalyticsTracker trackEventWithCategory:@"category1" action:@"action1" label:@"label1"];
NSNumber *value = [NSNumber numberWithInt:2];
[NZGoogleAnalyticsTracker trackEventWithCategory:@"category2" action:@"action2" label:@"label2" value:value];
[NZGoogleAnalyticsTracker trackEventWithCategory:@"category3" action:@"action3" label:@"label3" value:value];
[NZGoogleAnalyticsTracker trackEventWithCategory:@"category4" action:@"action4" label:@"label4" value:value nonInteraction:YES];
}
此代码遵循MIT许可证的条款和条件。MIT许可证.
可以在wiki上找到每个NZGoogleAnalytics发布版本简要汇总。