Real-time analytics feature not working

I implemented GA in my code as shown in https://developers.google.com/analytics/devguides/collection/ios/devguide .

I start the GA tracker: [[GANTracker sharedTracker] startTrackerWithAccountID:gaAccountId dispatchPeriod:kDispatchPeriodSeconds delegate:self];

A GA profile is specified for mobile applications, and I use the Google Analytics SDK for iOS v1 (Legacy)

The problem is that the real-time function does not work. He always says that there are 0 visitors. Do you have any suggestions what could be the problem.

+4
source share
5 answers

You need to add trackPageView to the views you want to track.

+2
source

In the current (2.0) sdk you should use sendView instead of trackPageView: [[[GAI sharedInstance] defaultTracker] sendView: @ "my_view"];

Or you can use the already mentioned GAITrackedViewController.

But I noticed that the Realtime function does not always work, I sometimes experienced that completely deleting an account and / or creating a new one sometimes solves this problem. Also, it may just be busy on the server side, so it may just work already, but be delayed.

Sometimes I test my work account to see if the error is on me or not.

+2
source

In the AppDElegate.m file:

 #import "AppDelegate.h" #import "GAI.h" - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [GAI sharedInstance].trackUncaughtExceptions = YES; [GAI sharedInstance].dispatchInterval = 1; [[[GAI sharedInstance] logger]setLogLevel:kGAILogLevelVerbose]; id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"TrackingId"]; [GAI sharedInstance].defaultTracker = tracker; return YES; } 

In ViewController.h

 #import <UIKit/UIKit.h> #import "GAITrackedViewController.h" @interface FirstViewController : GAITrackedViewController @end 

In ViewController.m

 - (void)viewDidLoad { [super viewDidLoad]; self.screenName = @"RED Screen"; } 

Give it a try . It worked just fine for me. I tried more than three applications. And everyone works in real time. If your account for your application is new , you may need to wait 24 hours or more to see the result. Sometimes it takes time to display real-time data for no reason.

+2
source

Follow these steps, you will get the result in real time.

  • in appdelegate write setdespatchinterval

[GAI sharedInstance].dispatchInterval = 20;

2.add track the page as follows.

Extend view controller from GAITrackedViewController

 '@interface ActivityViewController : GAITrackedViewController @end' 

implement the viewdidload method of your view manager

- (void) viewDidAppear: (BOOL) animated {

  self.screenName = @"Home Screen"; 

}

how Google Analytics works, you can visit this link

https://www.e-nor.com/blog/google-analytics/mobile-analytics-real-time-reporting-not-what-youd-expect

Hope this helps someone.

+1
source

If you are confident in receiving data, but in real time, then please change the time interval to 1. This is fixed for me.

  // Optional: configure GAI options. GAI *gai = [GAI sharedInstance]; gai.dispatchInterval = 1; gai.trackUncaughtExceptions = YES; // report uncaught exceptions #ifdef DEBUG gai.logger.logLevel = kGAILogLevelVerbose; // remove before app releaseAppDelegate.m #endif 
0
source

All Articles