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
I set up the machines as you suggested and it all works just fine. Wireshark on a win7 with adhoc network where an ipad is signed in. If i use safari on the ipad i emidiately get the requests (with filter http.host contains "google") to google analytics, __utm.gif as it should be. However in the app I can't find any request to analytics. So I'm not sure what to search for in wireshark. Is the filter on "http.host contains "google"" alright? Or do I have to define some different filters? Maybe the SDK isn't using the same __utm.gif request as in HTML?
Google Analytics does request via HTTPS -> SSL encrypted. You should in fact see their requests using Charles. Just, you won't be able to see the content of those requests.
To negate your note right away; you can certainly see HTTP/s requests from the device itself as well using Charles.
See this blog entry for more on Charles' configuration.
Make sure you understand the fundamental difference between HTTP and HTTPS.
Edit: I was all wrong. Google Analytics does not use HTTPS for the tracking but plain HTTP (TCP Port 80). I have yet to find out on why the tracking requests are not visible when using Charles. They are however visible when using Wireshark.
-> Use Wireshark for tracing Google Analytics activity.
To get that accomplished, I am sharing the internet connection from my Mac with my iOS device as follows:
System Preferences -> Sharing -> Internet Sharing -> Share your connection from:Ethernet, To computers using:Wifi
Once connected, I make sure to minimize the network traffic of the Mac itself to prevent noisy tracing.
The rest is Wireshark magic and a bit hard to describe off the head (can not do it at this moment).
It looks like the iOS SDK for Analytics is using a different protocol than HTTP / HTTPS so it's not showing up in Charles.
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
With the latest version of Charles you can see GA tags and it's a bit easier then using the approach from Jordan Brough above. Steps:
Note that the GA SDK batches requests (although sometimes it looks like it makes single requests on occasion as well) so if you think you do not see your tag make sure you scroll through the batched request. If you are looking for screen views the parameter is cd. GA tags in CharlesProxy