一,神策埋点
BF215BF6-3BA8-4D3B-B04F-672F3C41DA16.png
// 集成神策
[self initSensorsAnalyticsWithLaunchOptions:launchOptions];
pragma mark-- 集成神策
-
(void)initSensorsAnalyticsWithLaunchOptions:(NSDictionary *)launchOptions {
// 初始化 SDK
SAConfigOptions *options = [[SAConfigOptions alloc] initWithServerURL:SA_SERVER_URL launchOptions:launchOptions];
[SensorsAnalyticsSDK sharedInstanceWithConfig:options];// 设置公共属性
[[SensorsAnalyticsSDK sharedInstance] registerSuperProperties:@{@"appName": @"hanYi"}];
// 追踪激活事件,详见:https://sensorsdata.cn/manual/app_channel_tracking.html
[[SensorsAnalyticsSDK sharedInstance] trackInstallation:@"AppInstall"];
// 打开自动采集, 并指定追踪哪些 AutoTrack 事件
// [[SensorsAnalyticsSDK sharedInstance] enableAutoTrack:SensorsAnalyticsEventTypeAppStart|
// SensorsAnalyticsEventTypeAppEnd|
// SensorsAnalyticsEventTypeAppViewScreen|
// SensorsAnalyticsEventTypeAppClick];
// 打通 App 与 H5,详见:https://sensorsdata.cn/manual/app_h5.html
[[SensorsAnalyticsSDK sharedInstance] addWebViewUserAgentSensorsDataFlag];//初始化 SDK 之后,可以在相应业务逻辑处通过 track: 方法追踪用户行为事件,并为事件添加自定义属性(触发的事件会存储到神策分析系统的 events 表中)。
// 记录搜索(search )事件
// [[SensorsAnalyticsSDK sharedInstance] track:@"ViewProduct"
// withProperties:@{@"searchKeyWord" : @"神策数据"}];
}
2.集成友盟
//集成友盟
[UMConfigure initWithAppkey:@"5d54c7fa4ca3573ff2000f66" channel:@"App Store"];
[MobClick setScenarioType:E_UM_NORMAL];//支持普通场景??
//开发者需要显式的调用此函数,日志系统才能工作
[UMCommonLogManager setUpUMCommonLogManager];
在继承模版里的生命周期中编写,
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[MobClick beginLogPageView:[NSString stringWithFormat:@"%@",[self class]]];
// NSLog(@"selfClass === %@",[NSString stringWithFormat:@"%@",[self class]]);
}
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[MobClick endLogPageView:[NSString stringWithFormat:@"%@",[self class]]];
}
网友评论