You are here: Developers > Ad Request API > Mobile ad requests > Mobile ad request examples

Mobile ad request examples

You can use mobile ad requests to send an ad requestCommunication from a web browser or app to an ad server to display an ad. URL and OpenX will send a structured delivery response in one of the following formats:

To render ads appropriately in your mobile appSynonymous with mobile. Refers to the use of an app via a mobile device, specifically to differentiate from mobile web. or siteAn OpenX component that represents top-level domains or sub-domains and is used to organize ad units. Sites enable you to target and report on inventory performance., you must configure your app to interpret the response.

If no matching ads are available for a particular ad request, OpenX returns an empty response. You should test a few ad requests to review how OpenX represents objects in its responses and make sure that your app is configured handle them.

Each mobile ad request contains an ad request URL, which references the ad unit to deliver an ad for and various parameters. For example:

Sample HTML mobile ad request

http://delivery_server_domain/ma/1.0/arh?auid=6

Sample JSON mobile ad request

http://delivery_server_domain/ma/1.0/arj?auid=6

Sample XML mobile ad request

http://delivery_server_domain/ma/1.0/arx?auid=6

Where:

HTTP header forwarding

To proxy ad or tracking request not sent directly from a mobile device to OpenX, one of the following HTTP headers must be forwarded to OpenX with the request:

  • Accept-Language

  • Host

  • Referer

  • User-Agent

  • X-Forwarded-For

Impression counting

To implement a client-side impression counting mechanism, your app must make a call to OpenX via an impression confirmation beaconAn element on a publisher’s website that is invisible to users while it gathers information. AKA “tracking pixels.”, which is embedded in pre-formatted responses. If your app does the final formatting, you must ensure proper handling of the beacon. Work with your OpenX account manager to ensure proper integration.

Managing refresh

To use the refresh_delay and refresh_max fields to manage refresh, your client application must:

  • Identify the refresh_delay and refresh_max fields in the XML or JSON response.

  • Append rc=COUNT, where COUNT is replaced with the iteration of the reload (e.g., first refresh has rc=1 and third has rc=3).

    For example:

    
    max = response.refresh_max
    delay = response.refresh_delay
    for (i=1;i++;i<=refresh_max) {
      sleep(delay)
      url = build_url() + "&rc=" + i
      fetch_ad(url)
    }

Feedback form