2019独角兽企业重金招聘Python工程师标准>>>
https://github.com/matomo-org/matomo-sdk-ios/tree/version-3
http://piwik.org
首先下载demo,把文件拖到项目中去,在AppDelegate.m文件填写piwik服务器的URL和编号;
例如:
static NSString * const PiwikServerURL = @"http://localhost/path/to/piwik/";
static NSString * const PiwikSiteID = @"2";
如果你没有进入一个你可以运行跟踪器Piwik服务器在调试模式。事件将被打印到控制台,而不是送到Piwik服务器上,
[PiwikTracker sharedInstance].debug = YES;
配置和使用:
1.创建和配置跟踪器
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[PiwikTracker sharedInstanceWithSiteID:PiwikSiteID baseURL:[NSURL URLWithString:PiwikServerURL]];
}
2.跟踪屏幕视图
[[PiwikTracker sharedInstance] sendViews:@"view1", @"view2", self.title, nil];
3.跟踪用户与应用程序交互时的自定义事件
[[PiwikTracker sharedInstance] sendEventWithCategory:@"Documentary" action:@"Play" name:@"Thrive" value:@8.0];
4.当用户与各种社交网络交互时跟踪
[[PiwikTracker sharedInstance] sendSocialInteraction:@"Like" target:@"cat.png" forNetwork:@"Facebook"];