Validate Ad Requests with an SSL Proxy

Ad requests are sent between the Audience Network SDK and the Audience Network ad server over HTTPS. You can test ad requests and responses by using an HTTPS proxy such as Charles (https://www.charlesproxy.com) to view all of the SSL/HTTPS traffic between your app and the internet.

Set Up Charles

To set up Charles as a proxy for Audience Network SSL/HTTPS traffic, do the following:

  1. Follow the installation instructions in the Charles online documentation to download and install Charles.
  2. Open the Charles app.
  3. In the Proxy menu, click SSL Proxying Settings.
  4. In the SSL Proxying Settings dialog, make sure that Enable SSL Proxying is selected.
  5. In the SSL Proxying Settings dialog, click Add and fill out the fields to add each of the following host locations:
    • Host: "graph.facebook.com" | Port: "8888"
    • Host: "graph.facebook.com" | Port: "443"

View Ad Requests

To view SSL/HTTPS traffic in Charles, open your app and request ads. Ad requests are sent from your mobile app to the Audience Network server at https://graph.facebook.com/network_ads_common, as shown in the following image.

If Charles does not display traffic for this endpoint, it is most likely that your mobile app did not make any ad requests to the Audience Network server. You should reexamine your app integration and app logic.

View Ad Responses

Ad responses are returned as JSON in the contents of the HTTPS response. The code member of the JSON response will contain one of the following return codes:

  • 0: The request has returned or has been filled with an ad.
  • 1001: No ad is available for the request. Your app can make another ad request after the specified time limit has elapsed.

The following JSON is an example of a successful ad response.

{
    "type": "ads",
    "code": 0,
        "placements": [{
            "definition": {
                "placement_id": "148789268824369_851969285173027",
                "type": "rewarded_video",
                "refresh": "0",
                "refresh_threshold": "-1",
                "min_viewability_percentage": "1",
                "viewability_check_ticker": "0",
                "viewability_check_interval": "100",
                "viewability_check_initial_delay": "0",
                "video_time_polling_interval": "200",
                "cacheable": true,
                "client_max_retry_count": "1",
                "invalidation_duration_in_seconds": "3600",
                "request_timeout": "30000"
            },
        ...
        }]
}