用于IOS的谷歌分析SDK不再跟踪屏幕或事件。曾经工作

时间:2021-10-03 12:59:16

several months ago I downloaded the latest version of the google analytics SDK for IOS to try out tracking analytics for my app. I followed all the instructions, downloaded the SDK, stubbed out the code, created google analytics account and appropriate property with its respective reporting view, plugged in the tracking code and it all worked great. (this was something I was working on that was not ready for production yet, so we did not make it live).

几个月前,我为IOS下载了最新版本的谷歌分析SDK,试用我的应用程序的跟踪分析。我按照所有说明,下载了SDK,删除了代码,创建了谷歌分析帐户和相应的属性及其各自的报告视图,插入了跟踪代码,这一切都很有效。 (这是我正在研究的尚未准备好生产的东西,所以我们没有让它生效)。

I put it down for a few months, then recently resurrected the code I had written, and for some reason google analytics no longer seems to be keeping track of screens that I am on, nor does it keep track of events that I track.

我把它放了几个月,然后最近复活了我写的代码,由于某些原因,谷歌分析似乎不再跟踪我所在的屏幕,也没有跟踪我追踪的事件。

I have verbose logging turned on, and this is about all of the information I get from the console now. I used to get a lot of info every time I sent data about a screen view or event to google analytics.

我打开了详细的日志记录,这是我现在从控制台获得的所有信息。每次我将有关屏幕视图或事件的数据发送到Google Analytics时,我都会获得大量信息。

Google analytics console output:

Google分析控制台输出:


VERBOSE: GoogleAnalytics 3.11 +[GAITrackerModel initialize] (GAITrackerModel.m:88): idfa class missing, won't collect idfa

VERBOSE:GoogleAnalytics 3.11 + [GAITrackerModel initialize](GAITrackerModel.m:88):idfa类缺失,不会收集idfa

this error message doesn't matter I do not think because I am not displaying any ads in my app

此错误消息无关紧要我不认为,因为我没有在我的应用程序中显示任何广告


INFO: GoogleAnalytics 3.11 -[GAIReachabilityChecker reachabilityFlagsChanged:] (GAIReachabilityChecker.m:159): Reachability flags update: 0X000002

信息:GoogleAnalytics 3.11 - [GAIReachabilityChecker reachabilityFlagsChanged:](GAIReachabilityChecker.m:159):可达标志更新:0X000002

I believe this status code indicates I am able to reach google analytics

我相信这个状态代码表明我能够访问谷歌分析


INFO: GoogleAnalytics 3.11 -[GAIBatchingDispatcher hitsForDispatch] (GAIBatchingDispatcher.m:368): No pending hits.

信息:GoogleAnalytics 3.11 - [GAIBatchingDispatcher hitsForDispatch](GAIBatchingDispatcher.m:368):没有待处理的匹配。

not really sure what this means, but after this message gets displayed I get no more feedback from google analytics whenever I try to send screen data or event data to it

不确定这意味着什么,但是在显示此消息后,每当我尝试向其发送屏幕数据或事件数据时,我都不再获得谷歌分析的反馈


Here is my code in the app delegate class:

这是我在app delegate类中的代码:

// setup google analytics

// Optional: automatically send uncaught exceptions to Google Analytics.

[GAI sharedInstance].trackUncaughtExceptions = YES;

// Optional: set Google Analytics dispatch interval to e.g. 20 seconds.
[GAI sharedInstance].dispatchInterval = 20;
[[GAI sharedInstance] setDryRun:NO];

// Optional: set Logger to VERBOSE for debug information.
[[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];

// Initialize tracker. Replace with your tracking ID.
[[GAI sharedInstance] trackerWithTrackingId:@"mytrackingIDgoeshere"];

id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];

tracker.allowIDFACollection = NO;

NSString *version = [[NSBundle mainBundle] `objectForInfoDictionaryKey:@"CFBundleShortVersionString"];`

[tracker set:kGAIAppVersion value:version];
[tracker set:kGAISampleRate value:@"50.0"];

Here is the code I use to manually send screen and event data.
Some of it is stubbed out to be made generic to not reveal personal info about my app.

这是我用来手动发送屏幕和事件数据的代码。其中一些被删除是通用的,不会透露有关我的应用程序的个人信息。

// MANUALLY STARTING A SESSION:

// start session

id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];

// You only need to set User ID on a tracker once. By setting it on the tracker, the ID will be

// sent with all subsequent hits.

[tracker set:@"&uid"
       value:self.sessionID];

[tracker send:[[GAIDictionaryBuilder 
       createEventWithCategory:@"User ID"            
                 action:@"User Starts Session" 
                  label:deviceLabel              
                  value:nil] build]];   

GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView];

[builder set:@"start" forKey:kGAISessionControl];
[tracker set:kGAIScreenName value:vcName];
[tracker send:[builder build]];


// MANUALLY ENDING A SESSION:

id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
    GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView];
    [builder set:@"end" forKey:kGAISessionControl];
    [tracker set:kGAIScreenName value:vcName];
    [tracker send:[builder build]];


// MANUALLY SENDING SCREEN VIEW INFO TO GA

id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
    [tracker set:kGAIScreenName value:sceneName];
    [tracker send:[[GAIDictionaryBuilder createScreenView]build]];

// EXAMPLE CODE OF MANUALLY SENDING EVENT DATA TO GA

id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
    [tracker set:kGAIScreenName value:sceneName];
    [tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"ui_action" action:@"table_row_selected" label:rowTitle value:nil]build]];
     [tracker set:kGAIScreenName value:nil];

And that is it. This all used to work, and I keep pouring over the documentation over and over again and nothing seems to be wrong.

就是这样。这一切都过去了,我一遍又一遍地倾听文档,似乎没有什么不对。

How do I troubleshoot this issue?

如何解决此问题?

Thank you for your time.

感谢您的时间。

Update: I created a new property with a different tracking code to track other types of information(basically I am using more than one tracker in my app now), and now for whatever reason the old tracker that I got working no longer works, despite whatever I try, but the other tracker that I use to log network info, i.e. web service calls etc does work. I am honestly thinking at this point this is a google thing. I don't comprehend why it was working and now it isn't. I did not change anything related to the original property or tracking info at all.

更新:我创建了一个具有不同跟踪代码的新属性来跟踪其他类型的信息(基本上我现在在我的应用程序中使用多个跟踪器),现在无论出于何种原因,我工作的旧跟踪器不再有效,尽管无论我尝试什么,但我用来记录网络信息的其他跟踪器,即Web服务调用等确实有效。老实说,我认为这是谷歌的事情。我不理解为什么它工作,现在不是。我没有改变任何与原始属性或跟踪信息相关的内容。

1 个解决方案

#1


Okay I found a solution. I created a brand new gmail account to do analytics with and created a new report and linked it to my app and that solved it for some reason.

好的,我找到了解决方案。我创建了一个全新的Gmail帐户来进行分析,并创建了一个新的报告并将其链接到我的应用程序,并且由于某种原因解决了这个问题。

#1


Okay I found a solution. I created a brand new gmail account to do analytics with and created a new report and linked it to my app and that solved it for some reason.

好的,我找到了解决方案。我创建了一个全新的Gmail帐户来进行分析,并创建了一个新的报告并将其链接到我的应用程序,并且由于某种原因解决了这个问题。