My configuration in Google Analytics account:
My code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
GAI *gai = [GAI sharedInstance];
//gai.optOut = YES;
gai.trackUncaughtExceptions = YES; // report uncaught exceptions
gai.logger.logLevel = kGAILogLevelVerbose; // remove before app release
[[GAI sharedInstance] setDispatchInterval:10.0];
[[GAI sharedInstance] trackerWithTrackingId:@"UA-xxxxxx-3"];
return YES;
}
In view controller:
(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated];
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; [tracker set:kGAIScreenName value:@"Detail Screen"]; [[GAI sharedInstance].defaultTracker send:[[GAIDictionaryBuilder createScreenView] build]];
}
It did shows in my console:
2015-06-24 15:03:36.592 GoogleAnalyticsDemoiOS[9540:264576] VERBOSE: GoogleAnalytics 3.12 +[GAITrackerModel initialize] (GAITrackerModel.m:88): idfa class missing, won't collect idfa
2015-06-24 15:03:36.619 GoogleAnalyticsDemoiOS[9540:264576] INFO: GoogleAnalytics 3.12 -[GAIReachabilityChecker reachabilityFlagsChanged:] (GAIReachabilityChecker.m:159): Reachability flags update: 0X000002
2015-06-24 15:03:36.644 GoogleAnalyticsDemoiOS[9540:264684] VERBOSE: GoogleAnalytics 3.12 -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:517): Saved hit: {
parameters = {
"&_crc" = 0;
"&_s" = 1;
"&_u" = ".etnoKo9L";
"&_v" = "mi3.1.2";
"&a" = 800078077;
"&aid" = "com.mycompany.app";
"&an" = GoogleAnalyticsDemoiOS;
"&av" = "1.0";
"&cd" = "Detail Screen";
"&cid" = "caf03508-eba6-42f8-9600-3832ce042907";
"&dm" = "x86_64";
"&ds" = app;
"&sr" = 750x1334;
"&t" = screenview;
"&tid" = "UA-xxxxxxxx-3";
"&ul" = en;
"&v" = 1;
"&z" = 663648936779959001;
gaiVersion = "3.12";
};
timestamp = "2015-06-24 07:03:36 +0000";
}
2015-06-24 15:03:36.644 GoogleAnalyticsDemoiOS[9540:264684] VERBOSE: GoogleAnalytics 3.12 __70-[GAIBatchingDispatcher checkIAdCampaignAttributionWithHitParameters:]_block_invoke (GAIBatchingDispatcher.m:749): iAd campaign tracking disabled because the iAd framework is not linked. See http://goo.gl/426NGa for instructions.
2015-06-24 15:03:46.642 GoogleAnalyticsDemoiOS[9540:264684] VERBOSE: GoogleAnalytics 3.12 -[GAIRequestBuilder requestGetUrl:payload:] (GAIRequestBuilder.m:195): building URLRequest for https://ssl.google-analytics.com/collect
2015-06-24 15:03:46.643 GoogleAnalyticsDemoiOS[9540:264684] VERBOSE: GoogleAnalytics 3.12 -[GAIBatchingDispatcher dispatchWithCompletionHandler:] (GAIBatchingDispatcher.m:632): Sending hit(s) GET: https://ssl.google-analytics.com/collect?av=1.0&cid=caf03508-eba6-42f8-9600-3832ce042907&tid=UA-64362429-3&a=800078077&dm=x86_64&cd=Detail+Screen&t=screenview&aid=com.wow.touch&ul=en&_u=.etnoKo9L&ds=app&sr=750x1334&v=1&_s=1&_crc=0&an=GoogleAnalyticsDemoiOS&_v=mi3.1.2&ht=1435129416641&qt=10001&z=663648936779959001
2015-06-24 15:03:46.710 GoogleAnalyticsDemoiOS[9540:264576] INFO: GoogleAnalytics 3.12 -[GAIBatchingDispatcher didSendHits:response:data:error:] (GAIBatchingDispatcher.m:226): Hit(s) dispatched: HTTP status -1
2015-06-24 15:03:46.710 GoogleAnalyticsDemoiOS[9540:264684] INFO: GoogleAnalytics 3.12 -[GAIBatchingDispatcher deleteHits:] (GAIBatchingDispatcher.m:529): hit(s) Successfully deleted
2015-06-24 15:03:46.711 GoogleAnalyticsDemoiOS[9540:264684] INFO: GoogleAnalytics 3.12 -[GAIBatchingDispatcher didSendHits:] (GAIBatchingDispatcher.m:237): 1 hit(s) sent
But in Realtime view, I always got 0 active users. Any idea? Thanks