You are here: Developers > Ad Request API > Image ad tags

Image ad tags

Last updated on June 7, 2017

You can use image ad tags to serve ads on webpages or in email messages through an HTML ad requestCommunication from a web browser or app to an ad server to display an ad..

Between the HTML body tags of the source code of your ad space, wrap each image tag (<img>) in an anchor (<a>) to enable click-tracking and delivery for the ad. CookiesSmall text files sent from a web server to a browser, then returned by the browser each time it logs on to that server. Advertisers use cookies to monitor the number of ads that have been shown to a visitor, while they are used by websites to gauge numbers of unique visitors. are typically used to track user interaction with image ads, such as clicks. The Ad ServerA complete digital advertising platform where publishers sell, manage, and deliver their advertising inventory across all digital formats. also records an impressionA single display of an ad on a web page, mobile app, or other delivery medium. For deals, impression is a metric to relay the total number of ads that have served. See also billable impression, forecasted impressions. when it receives a request and selects an ad (not through a separate client-side beaconAn element on a publisher’s website that is invisible to users while it gathers information. AKA “tracking pixels.”).

This page covers the following topics:

How image ad tags work

When a user browses to a webpage or opens an email message where you have implemented an image ad tagA small piece of code that defines the ad space where ads display on a website. It includes parameters that describe the inventory advertising campaigns can target, which may in turn display ads in the ad space.:

  1. The browser invokes an ad request for the ad unitThe smallest inventory component that represents the space on a site where ads display. referenced in the URL for the src attribute of the img tag.

    Each image tag requests a single ad unit. To fulfill multiple ad units for the same page, you must implement an image tag for each ad unit.

  2. OpenX receives the request, performs the ad selection, and returns a 302 redirect message to the browser pointing to the location of the image ad, such as on a content delivery network (CDNContent delivery network, a distributed system of computers that increases bandwidth for the client by providing copies of creative content (such as media files and metadata) at various points in a network. Creatives are typically hosted on a CDN.).

  3. The browser retrieves the selected image ad and renders it in the ad space.


Image ad tags have the following benefits:


The following image ad tag contains two URLs; the first is a click URL, and the second is an ad request URL.

Sample image ad tag

<a href="http://delivery_server_domain/w/1.0/rc?cs=4cbf34e0354e7&cb=INSERT_RANDOM_NUMBER_HERE" target="_blank">
<img src="http://delivery_server_domain/w/1.0/ai?auid=8&cs=4cbf34e0354e7&cb=INSERT_RANDOM_NUMBER_HERE" border="0" alt=""></a>


You can also include custom variable parameters in your image ad tags, such as webpage content, location, or user-specific data.

Sample custom variable for the user's gender


How to implement an image tag

To implement your image tag, paste it between the HTML body tags in the source code of your ad space. Place it in the location where you want the ad to display. For example:

Sample image ad tag in a webpage


Some content here.

Ad goes here.

<a href="http://delivery_server_domain/w/1.0/rc?cs=4cbf34e0354e7&cb=INSERT_RANDOM_NUMBER_HERE"target="_blank"><img src="http://delivery_server_domain/w/1.0/ai?auid=8&cs=4cbf34e0354e7&cb=INSERT_RANDOM_NUMBER_HERE"border="0"alt=""></a>

Some other content here.


Note: Replace the value of the cb parameter with a random number (preferably a dynamically auto-generated number from your CMS) for cachebusting purposes.

See also:

Feedback form