This article explains how Google Publisher Tags (GPT) handle ad requests and asynchronous rendering on webpages. You'll learn how to choose request modes, such as Single request architecture (SRA), and use SafeFrames to serve ads securely.
Google Publisher Tags (GPT) offer flexibility in how you request ads from Ad Manager and render them on your page. Find example GPT tags to learn how to specify request and rendering modes in your code.
On this page:
Request modes
Single request architecture (SRA)
SRA is the recommended request mode because it improves your page's loading speed and can guarantee roadblocks. When you use SRA, GPT requests all defined ad slots from Ad Manager when the first ad display call runs. SRA supports all Ad Manager creative types and line item types except Studio Dynamic ads.
To enable SRA, include enableSingleRequest() in your GPT code before enableServices() or display(). Calling enableSingleRequest() bundles all ad slots on the page into one request.
Multi-request mode
In multi-request mode (the default), GPT sends each defined ad slot to Ad Manager separately from your page content. Unlike SRA, multi-request tags don't guarantee roadblocks or exclusions (including competitive, same advertiser, and same creative). Learn more about roadblocks.
Rendering mode
GPT only supports asynchronous rendering, which allows your content and ads to load independently.
Each ad renders within a reserved space on the page until the ad is ready to display. Asynchronous rendering ensures that requesting and rendering ads doesn't block your page content from loading.
SafeFrames & friendly iframes for GPT
SafeFrame is a cross-domain iframe that supports rich interactions between page content and ads while preventing ads from accessing your data. Use SafeFrames and SafeFrame-compatible creatives for expandable ads instead of friendly iframes.
Enable SafeFrame and the HTML5 sandbox attribute whenever possible to reduce the risk of malicious creatives and prevent top-level navigation. Both features are enabled by default.
Ad Manager supports SafeFrame for GPT. However, AMPHTML ads serve into friendly iframes instead of SafeFrames. 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. Update these creatives to be SafeFrame-compatible to retain SafeFrame's security benefits. If updating the creatives isn't an option, use one of these methods to render reservation ads properly:
- Disable rendering in a SafeFrame and 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.