jonathanwiesel
jonathanwiesel

Reputation: 1034

Can't see Google Analytics data from my iOS app

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

[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:

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.

Upvotes: 1

Views: 1327

Answers (1)

RyanG
RyanG

Reputation: 4503

In my AppDelegate I have the following code in my 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

Upvotes: 1

Related Questions