What Is A SafeFrame and How It Helps Publishers?

Updated on: January 8, 2024
Looking to understand IAB SafeFrame and how to enable it for your ads? Let us help you then.

iFrames have been predominantly known to prevent a website’s elements from interacting with other elements present on the same page. From the advertising aspect, iFrames enable a publisher to position the ads so that they don’t get merged with the site’s content and impact the rest of the page’s layout.

But what it is actually, and why are we even talking about iFrames in a SafeFrame article? Because iFrames lay the foundation for SafeFrames and hence they are co-related. So, shall we begin?

What are iFrames?

Technically, iFrames are mini HTML tags that act as a container and are used to embed an ad on a web page. When an ad is placed in an iFrame, the ad stays inside the boundaries and doesn’t interact with the other elements of the particular page. Although an ad can be placed via JavaScript tag, the ad can interrupt the functioning of the page’s elements and hence, results in a bad user experience.

Though iFrames protect the publishers’ ads’ content, they also limit the capabilities of ads and reduce the value of ads that are restricted to iFrame. Besides, iFrames do not allow to change the ad size as per the requirements of an advertiser. Moreover, they restrict the usage of rich-media ads.

To resolve this problem, JavaScript tags can be used to serve rich-media or interactive ads even if they are inside the iFrame. But the catch is, JavaScript libraries may cause privacy and security issues by accessing user’s sensitive data such as email addresses, bank details, and so on. Hence, to overcome these challenges for both sellers and buyers, IAB introduced the SafeFrame. It facilitates necessary data collection and rich interaction such as ad expansion. Let’s start with the introduction of the SafeFrame.

What is a SafeFrame?

A SafeFrame is an API-enabled iFrame that opens a unified path of communication between ads’ content and page content. While the iFrame creates the container around the ads’ content, API enables the rich interaction between the ad and the served content on the web page. Now that you have a basic understanding of SafeFrames, let us tell you why you need to have SafeFrames.

What are the Benefits of SafeFrames for Publishers?

The following are the benefits of SafeFrames for publishers.

  • Greater Control
  • Greater Efficiency
  • User Protection

Greater Control

SafeFrames isolates publishers’ webpage code and ad code that helps in maintaining control over the page’s layout and also restrict the interference from the ads. Meanwhile, the API-enabled SafeFrame also provides the ability to decide which information should be accessible for the buyers or third-party vendors.

Greater Efficiency

When you add SafeFrames to your ad units, you enable the rich interaction while preventing the ad code from breaking the page’s function. Not only does this improve the revenue potential, but it also keeps the operational costs controlled as you don’t have to rely on a developer team to look into the issues.

User Protection

Though SafeFrames-enabled ad slots share information with ad content served to its API-enabled iframe, a publisher can choose what to share and what not to share. You can protect sensitive user information such as their personal email addresses, phone numbers, etc.

Undeniably, SafeFrame offers several benefits to the publishers. But it comes with a few drawbacks also. For example, when an ad is displayed inside a SafeFrame, ad-tech vendors cannot see what’s happening on the web page. The major challenge is faced by viewability vendors who cannot measure the ad viewability score. 

“Publishers have reported that sandbox mode can prevent legitimate creatives from loading, as well as third-party verification tools,”

– Michael Richardson, Chairman, Prebid.org 

In order to help the vendors, IAB introduced SafeFrame 1.0. So, let’s see what it is.

What is SafeFrame 1.0?

SafeFrame 1.0 enables the publishers and ad-tech vendors to know if an ad is in view, and collect information on ad viewability. However, to gain these details, the publisher has to make an external call via command $sf.ext.geom to enable the vendors to determine the viewable area of an ad inside SafeFrame.

IAB Safe Frame 1.0

To sum up, SafeFrame 1.0 is an IAB-developed form of sandboxing that sets rules for an ad’s behavior. Not only SafeFrame protects the ads, but it also prevents forced redirect ads.

“Sandboxing puts ads inside a protective container so they can’t misbehave on a publisher page,”

– Gabriel DeWitt, VP of Product and Tech Ops, Index Exchange (Src)

Still, many publishers aren’t enabling SafeFrames for their ads due to the reason stated above.

Should you use Google Ad Manager Safe Frames?

Yes, you can use it.

How to Enable SafeFrame in Google Ad Manager?

To enable SafeFrames in Google Ad Manager by default, the ad unit must have Google Publisher Tag type enabled. Also, the ad server offers four types of ad creatives i.e.:

  • Custom,
  • Third-party,
  • System-defined templates,
  • User-defined templates.

You don’t have to make any changes for Custom and third-party ad creatives as SafeFrames for the creatives are On by default. So, if you don’t want SafeFrames, you can simply disable it in the box. For System-defined and User-defined creatives, you can follow the same procedure and enable/disable the SafeFrame according to your requirements.

Enable Safe Frame in Google Ad Manager

Additional Note: Make sure that the advertisers share the ad creatives which are compatible with SafeFrame. Because you might get an ad creative that isn’t compatible with SafeFrame. Also, if you are getting demand via Google’s Ad Exchange, then you should know that AdX turns on SafeFrames by default. You cannot access demand via AdX without enabling SafeFrames.

How to Check If an Ad Slot is SafeFrame-enabled or Not?

If you aren’t sure if the SafeFrame is enabled or not, then you can do it via Google Publisher Console. All you need to do is to open the Publisher Console and look for the iFrame type in the ad slots.

I Frame type none

Safe Frame

For the ad slots that do not have any iFrame type, you will get the status as “None”.


Being a publisher, we know the primary concern for you is to provide the best user experience to your visitors. On the other hand, it is equally important to know how the users are interacting with the ads while keeping personal data secure. The good thing is SafeFrame offers all of the mentioned benefits. So, why not start exploring it? Let us know in the comments below if you face any problems while defining ad units with SafeFrames.

News and Tips for Publishers

Get the inside scoop on publishing and programmatic with our 5-minute newsletter.