Google Analytics HTTP status -1 when sending hit(s) by request GET https://ssl.google-analytics.com/collect

谁说我不能喝 提交于 2019-12-22 05:38:28

问题


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.

So, how to sent Hit(s) to GA when we are using GET to request https://ssl.google-analytics.com/collect...........?

来源:https://stackoverflow.com/questions/30363622/google-analytics-http-status-1-when-sending-hits-by-request-get-https-ssl-g

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!