谷歌分析不工作的iOS
我已经实施了3个步骤。
第1步:我已下载谷歌分析库文件,并将此文件添加到项目,
- GAI.h
- GAITrackedViewController.h
- GAITracker.h
- GAITransaction.h
-
GAITransactionItem.h
-
libGoogleAnalytics.a
- CoreData.framework
- SystemConfiguration.framework
第2步:在didFinishLaunchingWithOptions
添加此代码
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [UIApplication sharedApplication].statusBarHidden = NO; [GAI sharedInstance].trackUncaughtExceptions = YES; [GAI sharedInstance].dispatchInterval = 2; [GAI sharedInstance].debug=YES; [[GAI sharedInstance] trackerWithTrackingId:@"UA-XXXX-1"]; return YES; }
第3步:在我的HomeScreen
视图加载后启动图像我写了这个,我已经更新此标题:
#import "GAITrackedViewController.h" @interface BTSHomeViewController : GAITrackedViewController
和BTSHomeViewController.m
- (void)viewDidLoad { ... self.trackedViewName = @"Home"; }
注意:我写了self.trackedViewName = @"Home";
只有在第一页上没有在所有的页面中有必要写在所有的页面?
LOG也显示这个警告:
ld: warning: directory not found for option '-L/Users/Supriya/Desktop/BTS with Analytics/BTS 2.1/BTS/BTS/GoogleAnalytics/Library' ld: warning: directory not found for option '-F/Users/Supriya/Desktop/BTS with Analytics/BTS 2.1/BTS/../../Documents' ld: warning: directory not found for option '-F/Users/Supriya/Desktop/BTS with Analytics/BTS 2.1/BTS/../../../Documents'
当我在设备中运行我的代码后写这篇文章,谷歌分析不显示任何活动的用户。
这里是我的项目中我的框架文件夹的快照,我忘记添加任何库?
: 请帮忙,这是什么错误?
提前致谢。
-
只是为了确认,但是您已经使用移动应用的跟踪ID了吗? 为Web应用程序创build的跟踪ID在用于移动应用程序时不会给您任何东西。
-
一旦在App Delegate中完成了初始设置,跟踪就可以像这样轻松完成 –
[[[GAI sharedInstance] defaultTracker] trackView:@"Screen name"];
根据谷歌文档,你应该在viewDidAppear
而不是viewDidLoad
设置trackedviewname
。
为了确保你的ID是正确的,你应该尝试在没有自动屏幕测量的情况下testing分析,并使用[[[GAI sharedInstance] defaultTracker] sendView:page]
;