Google Analytics不接收数据

时间:2014-10-17 13:21:24

标签: ios google-analytics xcode6

我的应用中遇到Google Analytics问题。该网站似乎没有收到任何数据,但该应用程序似乎正确地发送它。我正在关注这个Ray Wenderlich教程,以及运行应用程序的地方,实时概述中应该有1个访问者。它一直说0。

我的AppDelegate.m

[GAI sharedInstance].trackUncaughtExceptions = YES;
[GAI sharedInstance].dispatchInterval = 20;
[[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];
[[GAI sharedInstance] trackerWithTrackingId:@"UA-********-2"];

我的ViewController.m

- (void)viewDidLoad
{
    [super viewDidLoad];-
    self.screenName = @"ScreenZero";
//more
}

我的控制台

2014-10-17 15:07:52.479 Wheels[25548:2342406] idfa class missing, won't collect idfa
2014-10-17 15:07:52.513 Wheels[25548:2342437] CoreData: warning: Unable to load class named 'GAIProperty' for entity 'GAIProperty'.  Class not found, using default NSManagedObject instead.
2014-10-17 15:07:52.923 Wheels[25548:2342406] INFO: GoogleAnalytics 3.09 -[GAIReachabilityChecker reachabilityFlagsChanged:] (GAIReachabilityChecker.m:159): Reachability flags update: 0X000002
2014-10-17 15:07:52.962 Wheels[25548:2342437] CoreData: warning: Unable to load class named 'GAIHit' for entity 'GAIHit'.  Class not found, using default NSManagedObject instead.
2014-10-17 15:07:52.978 Wheels[25548:2342437] VERBOSE: GoogleAnalytics 3.09 -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:431): Saved hit: {
    parameters =     {
        "&_crc" = 0;
        "&_u" = ".etno";
        "&_v" = "mi3.0.9";
        "&a" = 730280959;
        "&aid" = "com.samvandamme.Wheels";
        "&an" = Wheels;
        "&av" = "0.1";
        "&cd" = ScreenZero;
        "&cid" = "7deb1f6d-3407-47e6-8303-7bc6305cd706";
        "&sr" = 1024x768;
        "&t" = appview;
        "&tid" = "UA-********-2";
        "&ul" = en;
        "&v" = 1;
        "&z" = 15854684929669144728;
        gaiVersion = "3.09";
    };
    timestamp = "2014-10-17 13:07:52 +0000";
}
2014-10-17 15:08:12.537 Wheels[25548:2342437] VERBOSE: GoogleAnalytics 3.09 -[GAIRequestBuilder requestGetUrl:payload:] (GAIRequestBuilder.m:195): building URLRequest for https://ssl.google-analytics.com/collect
2014-10-17 15:08:12.538 Wheels[25548:2342437] VERBOSE: GoogleAnalytics 3.09 -[GAIBatchingDispatcher dispatchWithCompletionHandler:] (GAIBatchingDispatcher.m:536): Sending hit(s) GET: https://ssl.google-analytics.com/collect?av=0.1&a=730280959&cd=ScreenZero&t=appview&_crc=0&ul=en&_u=.etno&tid=UA-********-2&cid=7deb1f6d-3407-47e6-8303-7bc6305cd706&sr=1024x768&v=1&aid=com.samvandamme.Wheels&an=Wheels&_v=mi3.0.9&ht=1413551272962&qt=19574&z=15854684929669144728
2014-10-17 15:08:12.815 Wheels[25548:2342406] INFO: GoogleAnalytics 3.09 -[GAIBatchingDispatcher didSendHits:response:data:error:completionHandler:] (GAIBatchingDispatcher.m:161): Hit(s) dispatched: HTTP status 200
2014-10-17 15:08:12.816 Wheels[25548:2342437] INFO: GoogleAnalytics 3.09 -[GAIBatchingDispatcher deleteHits:] (GAIBatchingDispatcher.m:443): hit(s) Successfully dispatched
2014-10-17 15:08:12.821 Wheels[25548:2342437] INFO: GoogleAnalytics 3.09 -[GAIBatchingDispatcher didSendHits:sendMore:] (GAIBatchingDispatcher.m:174): 1 hit(s) sent

我的Google Analytics Problem

因此没有任何内容发送给GA。有什么想法吗?

5 个答案:

答案 0 :(得分:1)

我遇到的问题与你所遇到的问题类似,但我认为这与丢失的图书馆有关。看起来您的核心数据类可能会丢失。要解决此问题,请尝试导入框架并让我知道它是如何进行的。

尝试这样做:

Go to: Build Phases > Link Binary With Libraries > (Click the plus button) > Search for CoreData.Framework

答案 1 :(得分:1)

我正在传递同样的问题,对我来说,我试过了:

Google iOS SDK 3.12

-(void)setupGoogleAnalytics {
        //Start Google Analytics
        NSDictionary *appDefaults = @{kAllowTracking: @(YES)};
        [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
        // User must be able to opt out of tracking
        [GAI sharedInstance].optOut =
        ![[NSUserDefaults standardUserDefaults] boolForKey:kAllowTracking];

        self.tracker = [[GAI sharedInstance] trackerWithName:@"App name"
                                                  trackingId:@"UA-XXXXX"];
        [self.tracker set:kGAIScreenName value:@"Begin"];

        [self.tracker send:[[GAIDictionaryBuilder createScreenView] build]];
        // Optional: set Google Analytics dispatch interval to e.g. 20 seconds.
        [GAI sharedInstance].dispatchInterval = 20;
        // Optional: set Logger to VERBOSE for debug information.
        [[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];

        [[GAI sharedInstance] dispatch];


    }

通过上面的那个块,我可以在调试模式下测试设备上GA实时页面中运行的实现。也许你必须等待30秒或更长时间,但为我工作。

答案 2 :(得分:0)

这是我的解决方案

如果你有带iOS SDK 8.1的Xcode 6.1。 然后选择目标部署目标为7.0 。 在项目中,iOS部署到8.1

比链接档案,请不要拖放。 (libAdIdAccess.a和libGoogleAnalyticsServices.a) 转到目标 - >将军 - >添加框架,并将存档添加并复制到您的文件夹中。 Pic 1

在Build设置中转到其他链接器Flags并添加 -ObjC Pic 2

并在App Delegate中将此添加到didFinishLaunching方法中以停用IDFA:

id tracker = [[GAI sharedInstance] defaultTracker]; tracker.allowIDFACollection = NO;

这适用于我并删除所有错误和GA接收的数据。

答案 3 :(得分:0)

只需设置

[[GAI sharedInstance] setDryRun:NO];

答案 4 :(得分:0)

此警告不会影响GA流程,您仍会在GA网络门户上获取数据。