Ad Tags

Ad tags are used for many purposes in display advertising:

These tags are all essentially the same in structure: they are all requests for content of a certain size and type from a certain URL. The content is either a creative or another ad tag and it may be returned immediately in one step or after multiple steps (an auction, redirects, etc.) each with its own tag. An ad tag may look very long and complicated if information about the ad call is included in the tag itself, or it might be very short and simple if ad call information is stored in the server to which the tag's URL is pointed.

How Ad Tags Work

Here's a simple example of how ad tags move through different systems. The example uses one ad server but in reality publishers and advertisers may each have their own ad servers: the publisher to track the impressions and the advertiser to determine which ads to serve.
  1. When the user visits a publisher web site, the browser sends an ad tag to the ad server. This ad tag contains information about the user and the ad placement.
  2. The ad server optionally passes an ad tag to a third-party data provider to retrieve information about user segmenting or contextual targeting.
  3. The ad server then passes an ad tag to the advertisers. Depending on the publisher-advertiser relationship, this may mean simply directly requesting ads for guaranteed buys, or it may involve requesting bids from multiple advertisers and carrying out an auction to determine the most profitable result for the publisher.
  4. The ad server delivers the creative (the ad) to the browser. Typically, this means returning an ad tag with a creative URL, with the creative itself hosted on an independent content server.  For more information about creatives, see Creatives: An Overview.

What Does an Ad Tag Look Like?

An ad tag has two parts:

The purpose of the code is to tell the browser how to display the ad (or other content) that they get from the URL request. For example, the HTML <iframe> tag tells the browser to open a mini browser window of a specified size inside the current window. This way the ad content cannot expand beyond the size specified and "take over" the screen.

For example, here's a Xandr ad tag that a publisher would use to auction an impression.

<script src="" type="text/javascript"></script> 

This is what the different parts of the tag are doing:

When the Xandr impression bus receives the tag, it runs an auction. Something like the following raw JavaScript code is returned to the browser:

document.write('<iframe frameborder="0" width="160" height="600" marginheight="0" marginwidth="0" target="_blank" scrolling="no"

This is what the different elements of the JavaScript are doing:

Most people dealing with ad tags (publishers, who need tags to put on their inventory pages, and advertisers, who may use tags to direct a browser to their creative) aren't hand building tags; they are inputting their page information or creatives into their ad server's user interface, which creates a properly formatted ad tag for them.

Further Examples

There are many permutations of ad tag syntax depending on what the tag is doing and whether the ad tag info is on the page or in a server. 

A publisher ensures that the ad is an iframe.

<iframe src="" width=160 height=600 
scrolling=no frameborder=0 padding=0></iframe>

A Google AdSense tag

<script type="text/javascript"><!--
google_ad_client = "pub-11111111";
/* 160x600 - TOP */
google_ad_slot = "12345";
google_ad_width = 160;
google_ad_height = 600;
<script type="text/javascript" 

Even though it looks like a piece of the tag is commented out with "!–", this isn't really the case. Some scripting engines, including those for JavaScript, allow the script statements to be enclosed in a comment. Then a browser that doesn't recognize the JavaScript element will ignore the comment, but others will execute it. This particular faux comment is passing information to the Google ad server in order to determine the right ad to show on the page.

A publisher provides alternate content for browsers with JavaScript disabled.

<SCRIPT type="text/javascript"
<A HREF="">
<IMG SRC=""></A>

In the NOSCRIPT section, the HREF link is the landing page of the ad and the SRC is the ad itself.

Related Topics