在iPhone应用程序上监控Google Analytics请求 [英] Monitor Google Analytics requests on an iPhone Application

查看:107
本文介绍了在iPhone应用程序上监控Google Analytics请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图监控iPhone应用程序上的Google Analytics请求,出于某种原因,我没有看到任何GA请求。但是,我可以看到并唯一标识Google Analytics分析界面上的流量。
我尝试过使用几种技术,包括使用Fiddler / Charles作为代理并重叠计算机IP。虽然我可以看到许多使用这种技术的http请求,但我没有看到任何与Google Analytics相关的请求。



可以做些什么来捕获这些请求?



注意:
据我所知,没有iOS应用程序可捕获实际设备上的HTTP请求。

问题是Google AnalyticsSDK所做的跟踪调用未使用iOS HTTP代理。

如果GA跟踪调用不使用iOS代理,他们显然不会被发送给Charles(或Fiddler或其他),并且它不能跟踪任何内容。监控这些电话的唯一方法是在计算机上执行诸如共享您的以太网连接的内容您的iOS设备无线连接,并使用诸如 ngrep WireShark 来监控通过无线接口(通常是Mac上的en1)传输的流量。这里有一个ngrep命令的例子:

  sudo ngrep -d en1 port 80 | grep --color -E -C 3'(google | utm.gif)'

在Mac上通过 homebrew 轻松安装ngrep)



<或者使用Wireshark,您可以开始监控您的无线接口(在Mac上为en1),并在过滤器框中输入http以过滤掉http流量。



如果您有应用程序的源代码,则另一个避免互联网连接共享的选项是通过Mac上的Xcode中的iOS模拟器运行应用程序,以便它使用Mac的互联网连接。 GA代码实际上仍然拒绝使用OSX配置的代理(即,您仍然无法使用Charles),但是您可以在Mac上使用ngrep或Wireshark(如上所述),而无需设置互联网连接共享。 p>

以下是我的博客中的更多详细信息:监控Google Analytics for iOS


I am trying to monitor the Google Analytics request on an iPhone application and for some reason I don't see any of GA the requests. However I can see and uniquely identify the traffic on the google analytics interface. I have tried using several technics including using Fiddler/Charles as a proxy and overlap the computer ip. While I can see many http request using this technic, I don't see any request that are related to Google Analytics.

What can be done to capture these requests?

Note: As far as I know, there is no iOS app to capture HTTP request on the actual device.

解决方案

The problem is that the tracking calls that the Google Analytics SDK makes are not using the iOS HTTP proxy.

If GA tracking calls doesn't use the iOS proxy they obviously won't be sent to Charles (or Fiddler or whatever) and it can't track anything. The only way to monitor these calls is to do something like share your ethernet internet connection on your computer to your iOS device wirelessly and use a tool like ngrep or WireShark to monitor the traffic coming through your wireless interface (usually en1 on a Mac). Here's an example ngrep command:

sudo ngrep -d en1 port 80 | grep --color -E -C 3 '(google|utm.gif)'

(You can easily install ngrep via homebrew on a Mac)

Or with Wireshark you can start monitoring your wireless interface (en1 on a Mac) and type "http" into the "Filter:" box to filter down to http traffic.

If you have the source code for the app then another option to avoid 'internet connection sharing' is to run the app via the iOS Simulator in Xcode on your Mac so that it uses your Mac's internet connection. The GA code actually still refuses to use the OSX-configured proxy (i.e., you still can't use Charles) but you can then use ngrep or Wireshark (as above) on your Mac without having to set up internet connection sharing.

Here's a post on my blog with more details: Monitoring Google Analytics for iOS

这篇关于在iPhone应用程序上监控Google Analytics请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆