SDTrackTool可以减少统计上报代码,实现较简单的无痕埋点。
- [√] Runtime
- [√] AOP**
- [√] 界面、事件统计可配置化
- [√] 减少垃圾代码
- [√] 可拓展性,方便切换任意统计SDK
- Hi维修
- Hi工程师
两种方式安装 SDTrackTool :
- CocoaPods
- 手动拖拽文件
platform :ios, '8.0'
pod 'SDTrackTool'
AppDelegate.m
#import "SDTrackTool.h"
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[SDTrackTool configure];
}
SDTrackTool.m
#import "SDTrackTool.h"
...
+ (void)configure {
//第三方统计sdk配置
// UMConfigInstance.appKey = UMENG_KEY;
// UMConfigInstance.eSType = E_UM_NORMAL;
//// UMConfigInstance.ePolicy = 0;
// NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
// NSString *currentVersion = [infoDict objectForKey:@"CFBundleShortVersionString"];
// [MobClick setAppVersion:currentVersion];
// [MobClick startWithConfigure:UMConfigInstance];
//
//#ifdef DEBUG
// [MobClick setLogEnabled:YES];
// [MobClick setCrashReportEnabled:NO];
//#endif
}
+(void)beginLogPageID:(NSString *)pageID {
// [MobClick beginLogPageView:pageID];
}
+(void)endLogPageID:(NSString *)pageID {
// [MobClick endLogPageView:pageID];
}
+(void)logEvent:(NSString*)eventId {
// [MobClick event:eventId];
}
在要统计的界面 #import "SDTrackTool.h"
按照示例,填写配置SDTrackEvents.plist
All source code is licensed under the MIT License.