无法从我的iOS应用中查看Google Analytics数据

时间:2022-12-24 15:15:07

I did follow the tutorial in Google developer website and put this code on my App delegate:

我确实按照Google开发者网站上的教程进行操作,并将此代码放在我的App代理上:

[GAI sharedInstance].trackUncaughtExceptions = YES;
[GAI sharedInstance].dispatchInterval = 20;
[GAI sharedInstance].debug = NO;
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"My tracker code"];
[[GAI sharedInstance] trackerWithTrackingId:KGATrackerId];

Then in my viewcontrollers I placed this code in the viewDidLoad method:

然后在我的viewcontrollers中,我将此代码放在viewDidLoad方法中:

id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker trackView:@"Test View"];

When the GA debugger is on it actually states it's "hitting" the server with info; however in my Googla Analytics dashboard I can't see any new data in the newly created app section.

当GA调试器打开时,它实际上表明它正在用信息“命中”服务器;但是在我的Googla Analytics仪表板中,我在新创建的应用程序部分中看不到任何新数据。

1 个解决方案

#1


1  

In my AppDelegate I have the following code in my didFinishLaunchingWithOptions

在我的AppDelegate中,我在didFinishLaunchingWithOptions中有以下代码

[[GANTracker sharedTracker] startTrackerWithAccountID:@"YOUR-ID-HERE"
                                       dispatchPeriod:10
                                             delegate:nil];

And to track events, like button clicks, I use this snippet in various places:

要跟踪按钮点击等事件,我会在不同的地方使用此代码段:

NSError *error;
if (![[GANTracker sharedTracker] trackPageview:@"/login/TouchedSubmit"
                                     withError:&error]) {
    // Handle error here
}

I have used this in multiple apps and I have never had any issues with my events not getting sent to Google-- Hope this helps

我已经在多个应用程序中使用了这个,我从来没有遇到任何问题我的事件没有被发送到谷歌 - 希望这有帮助

#1


1  

In my AppDelegate I have the following code in my didFinishLaunchingWithOptions

在我的AppDelegate中,我在didFinishLaunchingWithOptions中有以下代码

[[GANTracker sharedTracker] startTrackerWithAccountID:@"YOUR-ID-HERE"
                                       dispatchPeriod:10
                                             delegate:nil];

And to track events, like button clicks, I use this snippet in various places:

要跟踪按钮点击等事件,我会在不同的地方使用此代码段:

NSError *error;
if (![[GANTracker sharedTracker] trackPageview:@"/login/TouchedSubmit"
                                     withError:&error]) {
    // Handle error here
}

I have used this in multiple apps and I have never had any issues with my events not getting sent to Google-- Hope this helps

我已经在多个应用程序中使用了这个,我从来没有遇到任何问题我的事件没有被发送到谷歌 - 希望这有帮助