Search code examples
iosobjective-cgoogle-analyticsevent-tracking

iOS - In Real-Time : "active user on app" always show "0" In Google Analytics


I have done the following code in my app.

            id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"My Track Id"];
            [tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"Show User"
                                                                  action:@"Show user Clicked"
                                                                   label:nil
                                                                   value:nil] build]];

I have installed my app in 3 or more devices, But i can not see the right now active user. It show me 0 always. How can i solve the problem.


Solution

  • I have solve the issue. I have just add the following code in AppDelegate.m file in my app.

     - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
       [GAI sharedInstance].trackUncaughtExceptions = YES;
       [[GAI sharedInstance].logger setLogLevel:kGAILogLevelVerbose];
       [GAI sharedInstance].dispatchInterval = 20;
       [[GAI sharedInstance]dispatch];
    
       return YES;
    }