Monitoring Google Analytics Queries in the iPhone App

I am trying to track a Google Analytics request in an iPhone application, and for some reason I do not see any GA requests. However, I can see and uniquely identify traffic in the Google Analytics interface. I tried using several methods, including using Fiddler / Charles as a proxy server and shutting down the ip computer. Although I see many http requests using this technique, I do not see any requests related to Google Analytics.

What can be done to capture these requests?

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

+7
source share
5 answers

The problem is that the tracking requests made by the Google Analytics SDK do not use the iOS HTTP proxy.

If GA tracking requests do not use the iOS proxy, they will obviously not be sent to Charles (or Fiddler or something else) and he will not be able to track anything. The only way to control these calls is to do something like share your Internet Internet connection on your computer to your iOS device wirelessly and use a tool like ngrep or WireShark to track traffic passing through your wireless interface (usually en1 on Mac). Here is 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 Mac)

Or with Wireshark you can start monitoring your wireless interface (en1 on Mac) and enter "http" in the "Filter:" field to filter before http traffic.

If you have the source code for the application, then another option to avoid โ€œsharing the Internetโ€ is to run the application through iOS Simulator in Xcode on your Mac so that it uses your Mac Internet connection. Actually, GA code still refuses to use a proxy configured on OSX (i.e. you still cannot use Charles), but then you can use ngrep or Wireshark (as mentioned above) on your Mac without having to install Internet sharing.

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

+2
source

Google Analytics makes a request through HTTPS โ†’ SSL encrypted. In fact, you should see their requests with the help of Charles. You simply cannot see the contents of these requests.

To immediately cancel your note; You can also see HTTP / s requests from the device itself using Charles.

See this post for more details on setting up Charles .

Make sure you understand the fundamental difference between HTTP and HTTPS.

Edit: I was wrong. Google Analytics does not use HTTPS for tracking, but simply HTTP (TCP port 80). I have yet to find out why tracking requests are not visible when using Charles. However, they are visible when using Wireshark.

-> Use Wireshark to track Google Analytics activity.

To achieve this, I am using the Internet connection from my Mac with my iOS device as follows:

System Settings โ†’ Sharing โ†’ Internet Sharing โ†’ Share your connection with: Ethernet, computers using: Wifi

After connecting, I try to minimize the network traffic of the Mac itself to prevent noisy tracing.

The rest is the magic of Wireshark and itโ€™s a little difficult to describe it from the head (it cannot do it at the moment).

+1
source

With the latest version of Charles, you can see the GA tags, and it's a bit easier than using the approach from Jordan Brough above. Steps:

  • Download the latest version of Charles.
  • Launch Charles and set up your iOS device to use Charles as a proxy in Settings-> Wi-Fi [username]. Click the I icon, then scroll down to the HTTP proxy . Click Manual and add the server IP address and port 8888.
  • Launch Mobile Safari and go to http://www.charlesproxy.com/getssl . Install Cert Root Cert.
  • In Charles, add the GA server in Proxy -> SSL Proxy Settings . GA server ssl.google-analytics.com .
  • Finish Charles and restart.

Please note that the SD SDK unpacks the requests (although sometimes it seems that it also makes separate requests), so if you think you donโ€™t see your tag, make sure you are viewing the batch request. If you are looking for screens, the cd parameter. GA tags in CharlesProxy

+1
source

I installed the machines as you suggested, and everything works fine. Wireshark on win7 with adhoc network where ipad is signed. If I use safari on the ipad, I get requests (with the http.host filter containing "google") in google analytics, __utm.gif, as it should be. However, in the application I can not find any query analytics. So I'm not sure what to look for in wirehark. The filter on "http.host contains" google "" ok? Or do I need to define several different filters? Perhaps the SDK does not use the same __utm.gif request as in HTML?

-one
source

It seems that the iOS SDK for Google Analytics uses a different protocol than HTTP / HTTPS, so it does not appear in Charl.

-2
source

All Articles