Search Images Maps Play YouTube News Gmail Drive More »
Sign in

The Google Publisher Tag

Choose the right GPT modes

The primary decision that you need to make when tagging your pages with the Google Publisher tag is whether to use Asynchronous or Synchronous rendering. You’ll also need to decide whether you want to fetch all ads in a single request (SRA mode) and which ad units and targeting criteria to apply. Generally, we recommend using asynchronous rendering with SRA enabled. This combination offers the best page load experience and guaranteed roadblocks. Learn more about the differences below.

Asynchronous or Synchronous rendering

What’s asynchronous rendering, and why is it recommended?

An asynchronous fetch means that the GPT code on your page does not block the HTML that follows it from loading. For example, if you have a rich media leaderboard that takes some time to render, with asynchronous tags the rest of the page will load while the creative is rendering rather than waiting for it to finish, resulting in a better user experience and less perceived latency.

There are two levels of asynchronous loading with GPT:

  • Asynchronous loading of the GPT JavaScript library. Using asynchronous mode (called in the <head> tag) means that the <body> section of your page will not wait for the GPT JavaScript library to load before rendering.

  • Asynchronous rendering of the creatives in the <body> section of the document. This allows HTML elements to load without waiting for the creatives before them to render.

We recommend that you load both the library and the creatives asynchronously in order to get the greatest performance benefit. However, it is possible to load the library synchronously but render the creatives asynchronously.

Cases where synchronous rendering might be preferable

Some ads may not render correctly in frames. Examples include expandable ads that expect to be written directly on the main page or creatives that attempt to access the DOM elements (and the JavaScript environment) directly on the page. These ads, which are often expandable or rich media, will not render properly in a friendly iframe. Work with your rich media providers to establish or obtain proper iframe-ready ad tags.

Additionally, if you are using a third-party creative with a size that differs from the ad slot, the iframe may cut off the ad or cause extra whitespace.

The IAB has also published a list of best practices for helping create iframe-friendly rich media ads. If these best practices are followed, most rich media ads should render properly, even in asynchronous mode.

Can I use asynchronous tags on some pages and synchronous on others? Can I use both tags the same page?

You can use asynchronous tags on some pages of your website and synchronous tags on others. This might be desirable if, for example, you typically use asynchronous tags but are running a campaign that uses rich media ads that do not work well with friendly iframes. In that case, you could use synchronous tags only on the pages to which that particular campaign will serve and asynchronous tags everywhere else.

You cannot mix asynchronous and synchronous tags on the same page (but you can load the JavaScript synchronously and render the creatives asynchronously).

Here are some examples of synchronous and asynchronous tags.

Single request architecture (SRA)

What’s SRA, and why is it recommended?

SRA (single request architecture) tags call all ads once in the header, rather than requesting each ad separately inline with the ad slot. We recommend using SRA because grouping all ad calls into a single request allows you to guarantee roadblocks (serving all creatives from a line item together on the same page). Additionally, your page load performance may benefit from a reduced number of requests.

If you've enabled single-request mode, you can also enable guaranteed roadblocks for your network. This feature enhances the Display creatives setting in your line items by giving you the option to display 'All'. When you select 'All', DFP only serves the line item if an ad request contains enough ad slots to display all of that line item's creatives. This feature will only work on pages tagged with GPT with SRA enabled. You can enable Guaranteed roadblocks by clicking the Admin tab and choosing Features in the column on the left.

Cases where non-SRA may be preferable

All DFP creative types and line item types are supported by SRA. However, there are some limited cases that are not supported:

  • DoubleClick tag rewind: A DoubleClick tag causes the ad server to retrieve a different ad from inventory that belongs to a DFA or DFP network. With rewind, if an ad on the target network is not available, an ad will be retrieved from the DFP network making the ad call instead. This rewind feature does not yet work in single request mode.

  • Google programmable ads are not compatible with SRA.

View our example tags to learn how to enable SRA.