简体   繁体   English

屏幕跟踪未显示在Google Analytics(分析)iOS上

[英]Screen Tracking not showing up on Google Analytics iOS

I have an app where I am trying to track screens with Google analytics. 我有一个应用程序,试图通过Google Analytics(分析)跟踪屏幕。

I have set everything up in the delegate, and tried to automatically track three screens. 我已经在代理中设置了所有内容,并尝试自动跟踪三个屏幕。 Out of the three screens, only 1 of them is automatically tracking, the other two I had to track manually. 在这三个屏幕中,只有一个是自动跟踪的,另外两个是我必须手动跟踪的。 I do not understand why this is the case, but I've tried looking for solutions and answers but none have come up. 我不明白为什么会这样,但是我尝试过寻找解决方案和答案,但是都没有。

The one class where the automatic screen tracking worked in in my SettingsViewController 自动屏幕跟踪在我的SettingsViewController中起作用的一类

in SettingsViewController.h I import "GAITrackedViewController.h" SettingsViewController.h我导入"GAITrackedViewController.h"

and in SettingsViewController.m I do the following: 在SettingsViewController.m中,执行以下操作:

- (void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];

    self.screenName = @"Settings";//GOOGLE ANALYTICS WAS IN ViewWillDisappear
    //rest of code

}

This works because in Google Analytics, I can see all the times that I've seen this view and I have all the tracking data necessary. 之所以可行,是因为在Google Analytics(分析)中,我可以看到该视图的所有时间,并且拥有所有必要的跟踪数据。

It gets annoying in my other two classes where I tried the EXACT SAME THING and did no get the same results. 在我尝试过EXACT SAME THING THING的其他两个班级中,它变得很烦人,但没有得到相同的结果。

In both my FriendView and HomeView I tried doing the automatic screen tracking, but that did not work in either view, so I tried implementing the manual screen tracking. 在FriendView和HomeView中,我都尝试执行自动屏幕跟踪,但是在任何一个视图中均不起作用,因此我尝试实现手动屏幕跟踪。

In both my HomeView and FriendView I do the following: 在HomeView和FriendView中,我都执行以下操作:

#import "GAI.h"
#import "GAIFields.h"
#import "GAIDictionaryBuilder.h"
#import "GAITrackedViewController.h" //Import from when I tried automatic screen tracking

and then I do 然后我做

-(void)viewDidAppear:(BOOL)animated{

    //self.screenName = @"Friends";//GOOGLE ANALYTICS

    [super viewWillAppear:animated];

    id tracker = [[GAI sharedInstance] defaultTracker];
    [tracker set:kGAIScreenName
           value:@"Friends"];

    [tracker send:[[GAIDictionaryBuilder createAppView] build]];

}

The manual tracking works better because I can see it under real time screen tracking. 手动跟踪效果更好,因为我可以在实时屏幕跟踪下看到它。 But for some reason I still cannot see FriendView or HomeView screen tracking under Behavior/ Screens in Google Analytics. 但是由于某些原因,我仍然无法在Google Analytics(分析)的“行为/屏幕”下看到FriendView或HomeView屏幕跟踪。 The only data I have is from the SettingsView. 我仅有的数据来自SettingsView。

I would much rather use the automatic screen tracking because it is less code, but I have tried this solution and various others to try and get automatic screen tracking to work, and to be visible in Google analytics but it just does not. 我宁愿使用自动屏幕跟踪,因为它的代码更少,但是我已经尝试过该解决方案以及其他各种解决方案 ,以尝试使自动屏幕跟踪能够正常工作,并且可以在Google Analytics(分析)中看到,但事实并非如此。

To be clear, in both cases, the data does not show up in my screen tracking data. 需要明确的是,在两种情况下,数据都不会显示在我的屏幕跟踪数据中。 Only my settingsView data is visible and sending. 仅我的settingsView数据可见并正在发送。 The only difference is that when I do the manual screen tracking I can see the data come in real time, but it still does not show up in the general screen data view. 唯一的区别是,当我进行手动屏幕跟踪时,我可以实时看到数据,但仍无法在常规屏幕数据视图中显示。

I am using v 3.0.7 in my app. 我在我的应用程序中使用v 3.0.7。

Thank you in advance for any solutions. 预先感谢您提供任何解决方案。

I also tried all different ways to track screen views in GA (manual vs auto, createAppView vs createScreenView, in viewDidAppear vs in viewWillAppear, etc) and for a long time I thought they weren't working. 我还尝试了所有不同的方法来跟踪GA中的屏幕视图(手动,自动,createAppView与createScreenView,viewDidAppear与viewWillAppear等),而且很长时间以来,我认为它们无法正常工作。 I also turned on verbose debug mode and everything seems correct (returning 200, screen name being logged as I expected). 我还打开了详细的调试模式,并且一切似乎都正确(返回200,按我的预期记录了屏幕名称)。 Later I realized that they were actually recorded, I was just looking at the wrong place in GA website. 后来我意识到它们实际上是被记录下来的,我只是在GA网站上看错了地方。

They are not in Site Content/All Pages, and they are not in Behavior Flow, or Events/Pages. 它们不在“网站内容/所有页面”中,也不在“行为流”或“事件/页面”中。 But if you select anything like an event, and select "Screen Name" as a primary or secondary dimension, then you can see all of them. 但是,如果您选择某个事件之类的内容,然后选择“屏幕名称”作为主要或次要维度,则可以看到所有这些内容。 Or you can create a customized report and directly display screen name. 或者,您可以创建自定义报告并直接显示屏幕名称。

I'm surprise that screen views are so hard to find in the GA web interface. 令我惊讶的是,在GA网络界面中很难找到屏幕视图。 I hope that Google can make a change to treat the screen views like web's pages, and be able to see a flow chart of the transitions. 我希望Google可以进行更改,以将屏幕视图视为网页,并能够查看转换的流程图。

EDIT: 编辑:

Then I realized that it's because I'm posting all the data into a view that's configured for website, not for mobile app. 然后我意识到这是因为我将所有数据发布到为网站而非移动应用程序配置的视图中。 (Initially we wanted to track app and web in the same view.) When I created a new GA view for mobile only, everything makes sense now. (最初,我们希望在同一视图中跟踪应用程序和网络。)当我仅为移动设备创建新的GA视图时,一切都变得有意义了。

Everything is perfectly fine only the section in which you are searching the screen is wrong. 一切都很好,只有搜索屏幕的那部分错误。 So go to > Reporting > Real Time > Screens to view you screen or else try to search SCREEN in the search box and that will give you various options then try them one by one to get the correct option. 因此,请转到>报告>实时>屏幕以查看屏幕,否则尝试在搜索框中搜索SCREEN,这将为您提供各种选项,然后逐一尝试以获取正确的选项。

在此处输入图片说明

To automatically measure views in your app, have your view controllers extend GAITrackedViewController. 要自动测量应用中的视图,请让视图控制器扩展GAITrackedViewController。 Set a property called screenName with the name of the screen that you want to appear in your reporting. 设置一个名为screenName的属性,并指定要在报告中显示的屏幕的名称。

For example, suppose you have a “Home Screen” view that you want to measure with a view controller header that looks like this: 例如,假设您有一个要使用如下所示的视图控制器标题进行测量的“主屏幕”视图:

@interface HomeViewController : UIViewController

You would update this header to: 您可以将此标头更新为:

#import "GAITrackedViewController.h"

@interface HomeViewController : GAITrackedViewController

You must also provide the view name to be used in your Google Analytics reports. 您还必须提供要在Google Analytics(分析)报告中使用的视图名称。 A good place to put this is the view controller's initializer method, if you have one, or the viewWillAppear: method: 一个合适的地方是视图控制器的初始化方法(如果有的话)或viewWillAppear:方法:

- (void)viewWillAppear:(BOOL)animated {
  [super viewWillAppear:animated];
  self.screenName = @"Home Screen";

}

For more information Please go through this link Google Analytics 有关更多信息,请通过此链接Google Analytics(分析)

the whole code is look like this 整个代码看起来像这样 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM