I am implementing Google Analytics. I can send Hit by:
[self.tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"Application" action:@"BecomeActive" label:@"WakeUp" value:NULL] build]];
Logs are:
VERBOSE: GoogleAnalytics 3.12 -[GAIRequestBuilder requestPostUrl:payload:compression:] (GAIRequestBuilder.m:167): building URLRequest for https://ssl.google-analytics.com/batch
VERBOSE: GoogleAnalytics 3.12 -[GAIBatchingDispatcher dispatchWithCompletionHandler:] (GAIBatchingDispatcher.m:632): Sending hit(s) POST: https://ssl.google-analytics.com/batch
INFO: GoogleAnalytics 3.12 -[GAIBatchingDispatcher didSendHits:response:data:error:] (GAIBatchingDispatcher.m:226): Hit(s) dispatched: HTTP status 200
INFO: GoogleAnalytics 3.12 -[GAIBatchingDispatcher deleteHits:] (GAIBatchingDispatcher.m:529): hit(s) Successfully deleted
INFO: GoogleAnalytics 3.12 -[GAIBatchingDispatcher didSendHits:] (GAIBatchingDispatcher.m:237): 2 hit(s) sent
BUT!!! When I try to send event like:
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
@try {
[tracker set:kGAIScreenName value:@"XxxxxTableView"];
[tracker send:[[GAIDictionaryBuilder createScreenView] build]];
}
@catch (NSException *exception) {
NSLog(@"[ERROR] in Automatic screen tracking: %@", exception.description);
}
I got following:
VERBOSE: GoogleAnalytics 3.12 -[GAIRequestBuilder requestGetUrl:payload:] (GAIRequestBuilder.m:195): building URLRequest for https://ssl.google-analytics.com/collect
VERBOSE: GoogleAnalytics 3.12 -[GAIBatchingDispatcher dispatchWithCompletionHandler:] (GAIBatchingDispatcher.m:632): Sending hit(s) GET: https://ssl.google-analytics.com/collect?av=3.5&cid=e4b9472c-bb43-48f8-8a99-b58a918cdfa9&tid=UA-47572144-2&a=1081489894&dm=iPhone7%2C2&cd=XxxxxTableView&t=screenview&aid=com.yyyyyyy.appName&ul=en&_u=.oK29L&ds=app&sr=640x1136&v=1&_s=65&_crc=0&an=App+Name&_v=mi3.1.2&ht=1432174659618&qt=5020&z=1540606593628258960
INFO: GoogleAnalytics 3.12 -[GAIBatchingDispatcher didSendHits:response:data:error:] (GAIBatchingDispatcher.m:226): Hit(s) dispatched: HTTP status -1
INFO: GoogleAnalytics 3.12 -[GAIBatchingDispatcher deleteHits:] (GAIBatchingDispatcher.m:529): hit(s) Successfully deleted
INFO: GoogleAnalytics 3.12 -[GAIBatchingDispatcher didSendHits:] (GAIBatchingDispatcher.m:237): 1 hit(s) sent
The HTTP Status is -1. And Google Analytics doesn't get this hit. I have tried to send this request through Web Browser, it get HTTP Status 200. And Google Analytics got this hit.