MobileTracking.h
、libMobileTracking.a
、sdkconfig.xml
三个文件拷贝到项目工程中,将sdkconfig.xml
上传到 web 服务器,使其可以通过 web 方式访问,假设其地址为http://xxxxxx.com/sdkconfig.xml
(其后会用到)。Other Linker Flags
选项里添加 -lxml2 -all_load
或 -lxml2 -force_load
静态库的绝对路径在使用的文件中引用 #import "MobileTracking.h".
使用说明:
在进行监测之前,必须进行初始化,通过以上的代码进行初始化操作
[MobileTracking sharedInstance]
SDK 会自动下载远程的配置文件,使用最新的配置文件进行参数的组装。
[[MobileTracking sharedInstance] configFromUrl:@“http://xxxxxx.com/sdkconfig.xml”];
通过调用以下的代码进行曝光的监测,
普通广告监测
[[MobileTracking sharedInstance] view:@"http://example.com/xxxxxx”];
可见性广告监测
[[MobileTracking sharedInstance] view:@"http://example.com/xxxxxx” ad:adview];
视频可见性广告监测
[[MobileTracking sharedInstance] viewVideo:@"http://example.com/xxxxxx” ad:adview];
[[MobileTracking sharedInstance] viewVideo:@"http://example.com/xxxxxx” ad:adview videoPlayType:type];
可见性广告JS监测
[[MobileTracking sharedInstance] jsView:@"http://example.com/xxxxxx” ad:adview];
视频可见性广告JS监测
[[MobileTracking sharedInstance] jsViewVideo:@"http://example.com/xxxxxx” ad:adview];
可见性广告监测停止,广告播放结束时调用
[[MobileTracking sharedInstance] stop:@"http://example.com/xxxxxx”];
通过调用以下的代码进行点击的监测,参数为第三方公司的监测地址
[[MobileTracking sharedInstance] click:@"http://example.com/xxxxxx"];
主要用于保存当前监测数据,不被丢失。建议放在AppDelegate的applicationDidEnterBackground方法中
[[MobileTracking sharedInstance] didEnterBackground];
重新读取缓存数据,主要用于保证当前监测数据,及时上报,建议放在AppDelegate的applicationWillEnterForeground方法中
[[MobileTracking sharedInstance] didEnterForeground];
主要用于保存当前监测数据,不被丢失。
[[MobileTracking sharedInstance] willTerminate];
建议在测试时候打开
[[MobileTracking sharedInstance] enableLog:YES];
SDK 的测试有两个方面:
请联系第三方监测平台完成测试