79 lines
2.2 KiB
Objective-C
79 lines
2.2 KiB
Objective-C
#import "EventMark.h"
|
|
#import <DataEyeSDK.h>
|
|
|
|
@interface EventMark ()
|
|
|
|
@property (nonatomic, strong) DataEyeSDK *dataEyeInstance;
|
|
|
|
@end
|
|
|
|
@implementation EventMark
|
|
|
|
// 静态实例变量
|
|
static EventMark *sharedInstance = nil;
|
|
|
|
// 类方法,用于获取单例实例
|
|
+ (instancetype)sharedEventMark {
|
|
static dispatch_once_t onceToken;
|
|
dispatch_once(&onceToken, ^{
|
|
sharedInstance = [[self alloc] init];
|
|
});
|
|
return sharedInstance;
|
|
|
|
}
|
|
|
|
// 初始化 DataEyeSDK 的方法
|
|
- (void)initDataEyeSDK {
|
|
|
|
// NSLog(@"barry initDataEyeSDK-------");
|
|
DEConfig *config = [[DEConfig alloc] init];
|
|
config.appid = @"13355";
|
|
config.configureURL = @"https://yu.frozenarena.top";
|
|
config.debugMode = DataEyeDebug;
|
|
DataEyeSDK * instance = [DataEyeSDK startWithConfig:config];
|
|
|
|
NSDictionary *superProperties = @{
|
|
@"channel": @"ta",
|
|
@"age": @1,
|
|
@"isSuccess": @YES,
|
|
@"birthday": [NSDate date],
|
|
@"object": @{
|
|
@"key":@"value"
|
|
},
|
|
@"object_arr":@[
|
|
@{
|
|
@"key":@"value"
|
|
}
|
|
],
|
|
@"arr": @[@"value"],
|
|
};
|
|
[instance setSuperProperties:superProperties];
|
|
|
|
[instance enableAutoTrack:DataEyeEventTypeAppStart |//APP 启动事件,记录 APP 启动或从后台恢复
|
|
DataEyeEventTypeAppInstall |//APP 安装,记录 APP 被安装的日志
|
|
DataEyeEventTypeAppEnd |//APP 关闭事件,记录 APP 调入后台
|
|
DataEyeEventTypeAppViewScreen |//APP 浏览页面事件
|
|
DataEyeEventTypeAppClick |//APP 点击控件事件
|
|
DataEyeEventTypeAppViewCrash];//APP 崩溃事件
|
|
|
|
// NSDictionary *eventProperties = @{@"new_head": @"100"};
|
|
// [instance track:@"product_buy" properties:eventProperties];
|
|
|
|
NSString *device = [instance getDeviceId];
|
|
// NSLog(@"barry initDataEyeSDK11-------%@",device);
|
|
|
|
// [self trackProduct: @"100"];
|
|
}
|
|
|
|
// 追踪产品购买事件的方法
|
|
//- (void)trackProduct:(NSString *) data_ {
|
|
//
|
|
// NSLog(@"barry trackProduct-------%@",data_);
|
|
// NSDictionary *eventProperties = data_;
|
|
// [self.dataEyeInstance track:@"test_event" properties:eventProperties];
|
|
//}
|
|
|
|
|
|
@end
|
|
|