Is it possible to track the app with Google Analyt

2019-07-18 13:15发布

问题:

I tried to track my app using Google Analytics but didn't see when it opened in "real-time mode".

I'm using Google Analytics for Mobile Apps iOS SDK v3.

In Delegate.m:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
    // 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 = 20;

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

    // Initialize tracker.
    [[GAI sharedInstance] trackerWithTrackingId:@"UA-MYTRACKID-HERE"];

    return YES;
}

Maybe, it's not possible in IOS Simulator?

回答1:

Google Analytics work in iOS Simulator too. Just give it a little time in order to appear in real time data (usually 5-10 secs). The only issue with the simulator is that Google Analytics may report the iPad simulator as an iPhone but this is not such a big deal.