Google Publisher Tags offer flexibility in how you request ads from Ad Manager, and you'll then render those ads on your page in asynchronous mode. Developers can view example tags to learn how to specify request and rendering modes in your code.
Single request architecture (SRA)
When you use SRA, all ad requests for a page view are sent to Ad Manager at one time from the header of your content, which can improve your page’s loading speed and makes it possible to guarantee roadblocks. All Ad Manager creative types and line item types are supported by SRA, except Studio Dynamic ads. This is the recommended request mode.
To enable SRA, include
googletag.pubads().enableSingleRequest(); in your GPT code. This line calls all ad slots on the page at once and allows for guaranteed roadblocks.
Create one SRA request with all ad slots to best serve guaranteed roadblocks or competitive exclusions, instead of sending SRA requests with one ad slot at a time.
With a multi-request tag, each ad request defined is sent to Ad Manager separately from the body of your content. Unlike with SRA, multi-request tags do not guarantee roadblocks or exclusions (including competitive, same advertiser and same creative). This is the default request mode.
GPT only supports asynchronous rendering. This allows your content and ads to load independently. Each ad renders within an iframe that’s reserved on the page until the ad is ready to display. If a creative is slow in loading, your content does not need to wait.
SafeFrames and friendly iframes for GPT
SafeFrame is a cross-domain iframe that enables transparent and rich interactions between page content and ads, while preventing ads from accessing publisher data. We recommend using SafeFrames and creatives compatible with SafeFrame for expansion instead of friendly iframes. Learn more about rendering creatives using SafeFrame
To minimize the chances of malicious creatives serving, we recommend enabling SafeFrame whenever possible, in conjunction with the HTML5
sandbox attribute to prevent top-level navigation. Learn more about the
SafeFrame is supported in Ad Manager and enabled by default when using Google Publisher Tags. AMPHTML ads do not serve into SafeFrames, and use friendly iframes instead. Learn more about SafeFrame and AMP
Some creatives, such as expandable ads or creatives that access your page’s DOM elements, might not render correctly in SafeFrames or other cross-domain iframes. We recommend updating these creatives to make them SafeFrame-compatible, in order to retain SafeFrame’s security benefits. If this is absolutely not an option, there are a few things you can do to allow reservation ads of this type to render properly:
- Disable rendering in a SafeFrame and thus use a friendly iframe.
- Convert custom templates to work with friendly iframes.
- Follow the IAB's best practices for iframe-friendly rich content ads.
- Use an iframe buster to serve expandable creatives.