The following code examples include the various attributes that you use to create JavaScript, iframe, and image DART ad tags. The attributes that you use to construct your ad tags determine which ads are targeted to your website.
For information about Google Publisher Tags (GPT), see the Google Publisher Tag Help Center topic.
Guidelines and limitations
-
Ad tags and their individual components are not case-sensitive.
-
As a best practice, we recommend putting the
ordkey-value at the end of your ad tags; this value will help you defeat browser caching. -
The maximum length of a URL in an ad request is 2,000 characters; any additional characters will be truncated.
Determine which tag to use
Use the following table to determine when to use a standard image, JavaScript, or iframe DART ad tag.
| DART ad tag type | Creative types served | Multiple sizes in same ad unit | Browser support | Restricts ad to a frame | Page load issues | Loads ad before rest of page | Ad elements in same domain as site | |||
|---|---|---|---|---|---|---|---|---|---|---|
| GIF (static or animated), JPG | Redirects | Rich or entertaining content (Flash, third-party, custom) | Expandable/ |
|||||||
| Standard image tag | Yes | Yes | No | No | No | All | No | No | Yes | Yes |
| JavaScript | Yes | Yes | Yes | Yes | Yes | All | No | Yes | Yes | Yes |
| Iframe | Yes | Yes | Yes | No | No | Renders differently depending on the browser | Yes, unless you implement an iframe buster | Yes | Can isolate ad from rest of page | No |
Definitions of standard DART ad tag attributes
| Attribute | Explanation |
|
|---|---|---|
|
An HTML anchor element and hyperlink target attribute; this tag is a hypertext link to DFP. |
|
|
An HTML image element and source attribute; defines the location of a graphic file and requests a creative from DFP. |
|
|
The generic address of the ad server; ad.doubleclick.net, is the address used for ads served from U.S. data centers. A data center is a collection of ad servers in one location. |
|
|
Indicates the code for the DFP network in which this ad is booked. The network code can be found in the Admin tab of your DFP network. Ex: For networks that upgraded from DART: All ads that you trafficked in DART will continue to serve to your current tags. Any new line items that are trafficked to sites or zones that you created in DART will continue to serve to those tags. However, if you are generating ad tags for ad units that were created in DFP after you upgraded, those ad tags must have the network code in them. |
|
|
An optional country code that specifies the data center from which ads are served. The country code that you use depends on your contractual agreement with DoubleClick. This country code is optional. If you do not specify a country the ad is delivered from the main data centers in the United States no matter where the website's server is located. If you specify a country code, the ad request goes directly to that data center. Specifying a country code may reduce the load time for web pages. A member of our Support team must first configure your ad network to accept country codes before you can insert these codes in the ad tags. |
|
Data Center |
Code |
|
United States |
No code is specified The examples in this document show ads served from the U.S. data centers. |
|
Australia |
|
|
France |
|
|
Germany |
|
|
Hong Kong |
|
|
Japan |
|
|
Sweden |
|
|
United Kingdom |
|
|
|
A command, passed to the ad servers, that is used for counting clicks. This command is substituted dynamically with the click-through URL of the creative. |
|
|
Indicates the type of creatives that an ad tag can serve. |
|
The code: |
Indicates an ad tag: |
|
|
Can only accept image creatives. |
|
|
Can accept Flash, rich content, or image creatives in a frame. |
|
|
Can accept Flash, rich content, or image creatives in a layer. |
|
|
Can accept Flash, rich content, or image creatives in an iframe. |
|
|
Can accept Flash, rich content, or image creatives and will serve them by JavaScript. |
|
|
Can accept Flash, rich content, or image creatives and will serve them using streaming technologies. |
|
|
The name of a first level ad unit in your DFP network. For information about ad units, see Define and build your website's inventory. |
|
|
The name of a second level ad unit in your DFP network. For information about ad units, see Define and build your website's inventory. Note that every tag must have a first-level ad unit, but including a second-level ad unit is optional. |
|
|
A more granular way of defining your inventory than ad units. For more information about key-values, please refer to Define custom targeting criteria . |
|
|
Indicates the dimensions of an ad slot (in pixels).
You must always include the For example: |
|
|
A tile value is used to specify the order of an ad slot on a webpage. Without tile values properly implemented, you may find that roadblocks (creatives that are supposed to serve together) don’t always serve together, or that competitive exclusion doesn’t work properly. Tile values can also help prevent duplicate creatives from serving on the same page. The top tag on the page should have |
|
|
The ord value is used for cache-busting; to ensure that a fresh call is made to the ad server every time a page loads. Without the ord value properly implemented, you may experience impression counting discrepancies. You’ll need to add the ord value to the ad tags as per the examples above, and you’ll also need to have a piece of code in the top ad tag that generates a random number to populate the ord value on every tag. Make sure that you do not have more than one random number generator on the page. In the examples above, the random number generator is |
|
Image ad tags serve standard images such as GIFs (static or animated) and JPGs, as well as standard images hosted on DoubleClick servers trafficked as "DoubleClick tags" or hosted by a third party trafficked as "Third party" creatives. Image tags require minimal coding, but they can’t serve rich content of any kind; for example, no Flash.
adj or aid ad tag.The following HTML code example includes the various attributes that you use to create image ad tags. The attributes that you use to construct your image ad tags determine which ads are targeted to your website.
var ord = Number(ord) || Math.floor(Math.random()*10e12);
document.write('<a href="http://ad.doubleclick.net/Nnetwork_code/jump/first_level_ad_unit/second_level_ad_unit;pos=top;tile=tile_number;sz=widthxheight;ord=' + ord + '?" target="_blank" ><img="" src="http://ad.doubleclick.net/Nnetwork_code/ad/first_level_ad_unit/second_level_ad_unit;pos=top;tile=tile_number;sz=widthxheight;ord=' + ord + '?" ></a>');<="" br=""> </script>
<noscript>
<a href="http://ad.doubleclick.net/Nnetwork_code/jump/first_level_ad_unit/second_level_ad_unit;pos=top;tile=tile_number;sz=widthxheight;ord=1234567890?" target="_blank">
<img src="http://ad.doubleclick.net/Nnetwork_code/ad/first_level_ad_unit/second_level_ad_unit;pos=top;tile=tile_number;sz=widthxheight;ord=1234567890?" />
</a>
</noscript>
About JavaScript and iframe tags
JavaScript and iframe ad tags enable rich content creatives such as Flash and backup static images to be served to ad slots. The creative files for rich content ads are developed with advanced multimedia technologies such as scripts (for example, HTML, CGI, JavaScript, and Java), animation and video (such as Shockwave, Shockwave Flash, and RealVideo), or audio (such as RealAudio).
JavaScript and iframe ad tags are configured using JavaScript, frames, an iframe/layer-ilayer combination, or an iframe/JavaScript combination.
Example of a JavaScript ad tag
var ord = Number(ord) || Math.floor(Math.random()*10e12);
document.write('<a href="http://ad.doubleclick.net/Nnetwork_code/jump/first_level_ad_unit/second_level_ad_unit;pos=top;tile=tile_number;sz=widthxheight;ord=' + ord + '?" target="_blank"><img src="http://ad.doubleclick.net/Nnetwork_code/ad/first_level_ad_unit/second_level_ad_unit;pos=top;tile=tile_number;sz=widthxheight;ord=' + ord + '?" /></a>');
</script>
<noscript>
<a href="http://ad.doubleclick.net/Nnetwork_code/jump/first_level_ad_unit/second_level_ad_unit;pos=top;tile=tile_number;sz=widthxheight;ord=1234567890?" target="_blank">
<img src="http://ad.doubleclick.net/Nnetwork_code/ad/first_level_ad_unit/second_level_ad_unit;pos=top;tile=tile_number;sz=widthxheight;ord=1234567890?" />
</a>
</noscript>
Example of an iframe ad tag
var ord = Number(ord) || Math.floor(Math.random()*10e12);
document.write('<iframe src="http://ad.doubleclick.net/Nnetwork_code/adi/first_level_ad_unit/second_level_ad_unit;key=value;tile=tile_number;sz=widthxheight;ord=' + ord + '?" width="specified_width" height="specified_height" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>');
</script><
<noscript>
<a href="http://ad.doubleclick.net/Nnetwork_code/jump/first_level_ad_unit/second_level_ad_unit;key=value;tile=tile_number;sz=widthxheight;ord=1234567890?" target="_blank">
<img src="http://ad.doubleclick.net/Nnetwork_code/ad/first_level_ad_unit/second_level_ad_unit;key=value;tile=tile_number;sz=widthxheight;ord=1234567890?" />
</a>
</noscript>
