Capture mobile session traffic

Capturing HTTP network sessions can be a powerful troubleshooting exercise, allowing you to capture live ad requests and Ad Manager interactions. In addition, providing network sessions to Ad Manager support can help expedite issue resolution time by providing the necessary details to troubleshoot.

This article only applies to basic HTTP traffic. If you’re trying to capture secure HTTPS traffic, you’ll need to install a respective device certificate on your device before capturing traffic. Please consult your web debugging proxy for further instructions.

If you are using the Google Mobile Ads SDK, refer to the network tracing guide for Android or iOS. Using network tracing instead of proxy tools ensure you will see all traffic for all versions of these operating systems.

Alternatively, using a debugging proxy application such as Charles or Fiddler, you can also record both mobile web and mobile app network traffic from a mobile device. 

Requirements

  • A web debugging proxy, such as Charles or Fiddler
  • A Wi-Fi network that allows peer-to-peer traffic
  • A desktop or laptop computer
  • An iOS or Android mobile device

Proxy configuration

  1. Get your local IP address from your desktop or laptop computer.
    1. Windows: open Command Prompt. Type in ipconfig and press Enter. The text next to IPv4 Address is your local IP address.
    2. macOS: open Terminal. Type in ifconfig en0| grep "inet[ ]" | awk '{print $2}' and press Enter. The result will be your local ip address.
    3. Linux: open the terminal. Type in ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' and press Enter. The result will be your local ip address.
  2. Tell your mobile device about your desktop’s IP.
    • Android
      1. Click Settings > Wi-Fi and select your Wi-Fi network.
      2. Select the “Show advanced options” check box.
      3. Under “Proxy settings”, select the manual option and enter the IP address from step 1 in the “Proxy hostname” field.
      4. Enter 8888 in the “Proxy port” field.
      5. Click Save.
    • iOS
      1. Click Settings > Wi-Fi and select your Wi-Fi network.
      2. Under “HTTP Proxy”, select the Manual button.
      3. Enter the IP address from step 1 in the “Server” field.
      4. Enter 8888 in the “Port” field.
      5. Close out.
  3. Configure your web debugging proxy tool:
    1. Set the HTTP proxy port to 8888.
    2. (Charles only) If the “External Proxy Setting” is selected, deselect it.
    3. (Fiddler only) Select the “Allow remote computers to connect” option.
  4. Set up SSL (Charles only):
    1. At the menu bar, go to Proxy > SSL Proxy Settings.
    2. Click Add.
    3. Enter securepubads.g.doubleclick.net and googleads.g.doubleclick.net in the "Host" field and 443 in the "Port" field.
      You may also consider capturing all traffic by entering the wildcard "*" in the "Host" field while leaving the "Port" field blank. This can be useful when there's an issue outside the above two domains.
    4. Click OK.
    5. Install the Charles certificate on your machine by using the Charles SSL setup guidelines.
    6. Once your device is proxying to your desktop/laptop machine, go to your phone’s browser and type http://www.charlesproxy.com/getssl to download and install the machine certificate.
  5. Start capturing HTTP traffic from your mobile phone (Charles only).
    • You should see an alert asking if you want to allow your mobile device to connect. Select Allow.
  6. When you have finished capturing network traffic, be sure to turn off the proxy settings on your device by reversing step 2 (set proxy to None).

Considerations

  • Google does not endorse Charles or Fiddler HTTP Proxy in any way and you may use it at your own risk.
  • The HTTP proxy software can capture any activity from your device. Be sure to disable the proxy when finished recording the relevant traffic.
Was this helpful?
How can we improve it?