0

I just installed Google Analytics for iOS on an app I've been working on. I am just doing simple screen tracking for 3 views. Currently, I have been able to get everything to send Google Data (iPhone simulator, iPad simulator, iPhone device) EXCEPT an iPad device. Is there some sort of configuration I need to do to get the iPad device to work?

My code:

in AppDelegate.h:

#import <GoogleAnalytics-iOS-SDK/GAI.h>

in AppDelegate.m:

// Optional: automatically send uncaught exceptions to Google Analytics.
[GAI sharedInstance].trackUncaughtExceptions = YES;

// Optional: set Google Analytics dispatch interval to e.g. 20 seconds.
[GAI sharedInstance].dispatchInterval = 5;

// Optional: set Logger to VERBOSE for debug information.
[[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];

// Initialize tracker. Replace with your tracking ID.
[[GAI sharedInstance] trackerWithTrackingId:@"XXXXXXX"];

in all the UIViewControllers' .h files:

#import <GoogleAnalytics-iOS-SDK/GAITrackedViewController.h>
#import <GoogleAnalytics-iOS-SDK/GAIDictionaryBuilder.h>
#import <GoogleAnalytics-iOS-SDK/GAIFields.h>

@interface ViewController : GAITrackedViewController

in all the UIViewControllers' .m files:

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    // May return nil if a tracker has not already been initialized with a
    // property ID.
    id tracker = [[GAI sharedInstance] defaultTracker];

    // This screen name value will remain set on the tracker and sent with
    // hits until it is set to a new value or to nil.
    [tracker set:kGAIScreenName
       value:@"iPhone Main Screen"];

    // New SDK versions
    [tracker send:[[GAIDictionaryBuilder createScreenView] build]];
}

Any help is appreciated!!

Edit: I am using version 3.10 of the Google Analytics SDK if that helps

a.scarlett
  • 77
  • 1
  • 9

2 Answers2

0

Finally figured out what was happening. In the Real Time tab in the Google Analytics dashboard, there was (by default) a Mobile Devices tag at the top. Once I removed this, I was able to see iPad device messages being sent.

a.scarlett
  • 77
  • 1
  • 9
-1

No data in Google analytics realtime->overview tab? Is your app optimized for iPad?

Bhupendra Singh
  • 121
  • 1
  • 6