Yoko
Yoko

Reputation: 803

Google Analytics not receiving data

I'm having problems with Google Analytics in my app. The website doesn't seem to be receiving any data, but the app seems to send it rightfully. I'm following this Ray Wenderlich tutorial, and the point where you run the app, there should be 1 visitor in the Real-Time Overview. It keeps saying 0.

My AppDelegate.m

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

My ViewController.m

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

My Console

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

My Google Analytics Problem

So nothing gets sent to GA. Any ideas?

Upvotes: 5

Views: 2549

Answers (5)

Felipe FMMobile
Felipe FMMobile

Reputation: 1641

I was passing for that same problem, and for me I tried :

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];


    }

With that block above, I could test the implementation running in GA Real Time page on device in debug mode. Maybe you have to wwait 30 secs or more, but worked for me.

Upvotes: 1

gaurav bhardwaj
gaurav bhardwaj

Reputation: 51

This warning doesnt effect the GA process, you will still get data on your GA web portal.

Upvotes: 0

Murlakatam
Murlakatam

Reputation: 3265

Just set

[[GAI sharedInstance] setDryRun:NO];

Upvotes: 0

Nachtfux
Nachtfux

Reputation: 7

Here is my solution

If you have Xcode 6.1 with iOS SDK 8.1. Then choose your Target an the Deployment Target to 7.0. In the project the iOS Deployment to 8.1.

Than link the archives, please not with drag and drop. (libAdIdAccess.a and libGoogleAnalyticsServices.a) Go to target -> generals -> add frameworks and add and copy the archives into your folder. Pic 1

Than in Build settings go to the other linker Flags and add -ObjC Pic 2

and in the App Delegate add this in didFinishLaunching method for deactivate IDFA:

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

This works for me and delete all errors and the GA received data.

Upvotes: 0

Kevin Pimentel
Kevin Pimentel

Reputation: 1916

I am having a similar issue to the one you are having but I don't think it is related to missing libraries. It looks like your core data class might be missing. To fix this problem try importing the framework and let me know how it goes.

Try doing this:

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

Upvotes: 1

Related Questions