简体   繁体   English

适用于iOS的Google Analytics(v3.03) - 无法接收数据

[英]Google Analytics (v3.03) for iOS - not receiving data

I am having a wired problem with Google analytics for iOS. 我正在使用谷歌分析iOS的有线问题。 According to console, it seems that I am sending data, but when I look at realtime overview in Google Analytics, I see no response from my actions in the app. 根据控制台,似乎我正在发送数据,但是当我查看Google Analytics中的实时概述时,我看到我在应用中的操作没有响应。

This is how I have implemented the tracker: 这就是我实现跟踪器的方式:

In AppDelegate.h: 在AppDelegate.h中:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    //Start Google Analytics
    [GAI sharedInstance].dryRun = NO;
    [[GAI sharedInstance].logger setLogLevel:kGAILogLevelVerbose];
    [GAI sharedInstance].dispatchInterval = kGANDispatchPeriodSec; // 10 secs
    id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:kGANAccountId]; // UA-XXXXXX-XX
    [GAI sharedInstance].defaultTracker = tracker;

In MyViewController.h: #import "GAITrackedViewController.h" 在MyViewController.h中:#import“GAITrackedViewController.h”

@interface FRAdviceViewController : GAITrackedViewController {
    ...
}

In MyViewController.m: 在MyViewController.m中:

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSString *godeRaadPath = @"/godeRåd/";
    //[[GANTracker sharedTracker] trackPageview:[godeRaadPath stringByAppendingString:advice.title] withError:nil];
    self.screenName = [godeRaadPath stringByAppendingString:advice.title];

    ...
}

Basically, I set the screenName and hope that the GAITrackedViewController will do it's thing. 基本上,我设置了screenName,并希望GAITrackedViewController能够做到这一点。

I get the following message in console when loading the viewController: 加载viewController时,我在控制台中收到以下消息:

2014-04-23 11:47:46.889 TÆNK[256:3303] VERBOSE: GoogleAnalytics 3.03c -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:418): Saved hit: {
parameters =     {
    "&_u" = ".o";
    "&_v" = "mi3.0.3c";
    "&an" = "T\U00c6NK";
    "&av" = "1.8.2";
    "&cd" = "/s\U00e5danHarViTestetArtikel/S\U00e5dan har vi testet br\U00f8dristere";
    "&cid" = "d1c5e459-ed0b-49d0-b532-f81fb9ff1d85";
    "&sr" = 320x480;
    "&t" = appview;
    "&tid" = "UA-1418061-9";
    "&ul" = da;
    "&v" = 1;
    "&z" = 15611112842331434332;
    gaiVersion = "3.03c";
};
timestamp = "2014-04-23 09:47:46 +0000";
}
2014-04-23 11:47:56.914 TÆNK[256:3303] VERBOSE: GoogleAnalytics 3.03c -[GAIRequestBuilder requestGetUrl:payload:] (GAIRequestBuilder.m:177): building URLRequest for https://ssl.google-analytics.com/collect
2014-04-23 11:47:56.923 TÆNK[256:3303] VERBOSE: GoogleAnalytics 3.03c -[GAIBatchingDispatcher dispatch] (GAIBatchingDispatcher.m:503): Sending hit(s) GET: https://ssl.google-analytics.com/collect?av=1.8.2&cd=%2Fs%C3%A5danHarViTestetArtikel%2FS%C3%A5dan+har+vi+testet+br%C3%B8dristere&t=appview&ul=da&_u=.o&tid=UA-1418061-9&cid=d1c5e459-ed0b-49d0-b532-f81fb9ff1d85&v=1&sr=320x480&_v=mi3.0.3c&an=T%C3%86NK&ht=1398246466879&qt=10034&z=15611112842331434332
2014-04-23 11:47:57.210 TÆNK[256:60b] INFO: GoogleAnalytics 3.03c -[GAIBatchingDispatcher didSendHits:response:data:error:] (GAIBatchingDispatcher.m:157): Hit(s) dispatched: HTTP status 200
2014-04-23 11:47:57.214 TÆNK[256:3303] INFO: GoogleAnalytics 3.03c -[GAIBatchingDispatcher deleteHits:] (GAIBatchingDispatcher.m:430): hit(s) Successfully dispatched
2014-04-23 11:47:57.225 TÆNK[256:3303] INFO: GoogleAnalytics 3.03c -[GAIBatchingDispatcher didSendHits:] (GAIBatchingDispatcher.m:167): 1 hit(s) sent

What confuses me is, that it says: "HTTP status 200", "hit(s) successfully dispatched" and "1 hit(s) sent" - when I get no response on RealTime graphs. 令我困惑的是,它说:“HTTP状态200”,“命中成功发送”和“1次发送” - 当我在RealTime图上没有响应时。

(Tested on iPhone 4) (在iPhone 4上测试过)

Any help would be very much appreciated! 任何帮助将非常感谢!

EDIT: I should have been a bit more specific. 编辑:我应该更具体一点。 Our current version of the app has implemented Google Analytics already (but an older version, and XCode wont build with that version). 我们当前版本的应用已经实施了Google Analytics(但旧版本,XCode不会使用该版本构建)。 So I do see some activities on RealTime. 所以我确实在RealTime上看到了一些活动。 When I use the current version with old analytics, it works just fine and shows in realtime. 当我使用当前版本的旧分析时,它可以正常工作并实时显示。 But the test devices with my updated version of analytics don't show up. 但是我的更新版本的分析测试设备没有显示出来。

There is one nice uncleared issue that is not declared anywhere. 有一个很好的未清除问题,没有在任何地方声明。

When you are starting to work with analytics for the first time. 当您第一次开始使用分析时。 You go through few steps up to generating a config file. 您只需几步即可生成配置文件。 After you created and Downloaded config files and download GoogleService-Info.plist google automatically create credentials -> API keys : 创建并Downloaded config files并下载GoogleService-Info.plist Google会自动创建credentials -> API keys

  • Browser key (auto created by Google Service) 浏览器密钥(由Google服务自动创建)
  • Server key (auto created by Google Service) 服务器密钥(由Google服务自动创建)
  • iOS key (auto created by Google Service) iOS密钥(由Google服务自动创建)

With the status: 具有以下状态:

This API key is unrestricted. 此API密钥不受限制。 To prevent unauthorized use and quota theft, restrict your key to limit how it can be used. 为防止未经授权的使用和配额被盗,请限制密钥以限制其使用方式。

That's why analytics is not collecting your data. 这就是分析不收集数据的原因。

You need to go through few steps: 您需要完成几个步骤:

  1. Go to google developers console 转到谷歌开发者控制台
  2. Select a project 选择a project
  3. In the list of API keys click on unrestricted key - the form will appear API keys列表中,单击不受限制的键 - 将显示该表单
  4. In section Key restriction select iOS apps 在“ Key restriction部分中,选择iOS apps
  5. Set Accept requests from an iOS application with one of these bundle identifiers Accept requests from an iOS application with one of these bundle identifiers设置Accept requests from an iOS application with one of these bundle identifiers
  6. Save 保存

That`s all. 这就是全部。 And now Analytics will start to collect data. 现在,Analytics将开始收集数据。

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

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