‘SafeFrame’ is a term used for technology responsible for enhancing the delivery of ads on sites, protecting a site and its users from bad experiences caused by faulty ads. A lot of publishers complain about URLs being redirected, especially when it comes to mobile. Safe Frame testing is very useful, as ad sizes cannot be changed, and ad flexibility gets restricted. 

Understanding SafeFrame and its Functionalities

SafeFrame is an API-enabled iFrame, that allows digital publishers to earn ad revenue without relinquishing control over web page layouts or losing out on data sharing. The IAB or the Interactive Advertising Bureau is all set to overhaul SafeFrame from 2022, hence this is a great time for digital publishers to get familiar with ad protocol. SafeFrame originated in 2013 when some volunteers from the world’s tech giants convened to solve the technical and logistical challenges of iFrame. 

To understand how SafeFrame works it is imperative to understand iFrame. An HTML code that publishers insert into their web page code, the iFrame provides a fixed display window for 3rd-party content like videos or advertisements. Google Maps, YouTube, and Flickr use iFrames. 

Using iFrame has both advantages and disadvantages 

Pros – 

  • It isolates and prevents ad code from interacting with page content. 
  • It prevents ad content from affecting the rest of the page’s functionality. 
  • It prevents ads from collecting sensitive user information. 

Cons – 

  • They have intractable dimensions, and prevent user interaction, and are not very flexible in advertising terms. 
  • Ad dimensions may be incorrectly displayed. 
  • Ads cannot dynamically interact with website visitors. 
  • Collecting and viewing performance data is impossible. 

How Do You Overcome These Disadvantages?

Placing JavaScript within the web page code is one way to overcome these limitations, and this is what publishers, working with advertisers, end up doing. Using JavaScript, you can resize an iFrame and make it interactive. There are disadvantages to this though. Once JavaScript is inserted, permission to read and change anything on the host page becomes possible. The publisher and advertiser must maintain the trust that the latter will not purposely or unknowingly serve ad content that goes against the former’s interests. That control could lead to distortion of page layouts while paving the way for door-to-door conflicts that can end in the ad, webpage, or both broken. In such a situation, publisher-side files are used. 

Publisher side files or PSFs are custom JavaScript codes that advertisers create that are used on publishers’ websites. These codes dictate what an iFrame can or cannot access. Using such files you can serve rich media ads while retaining publisher control, protecting sensitive consumer information. Publishers may however find that they have to manage and maintain too many ad-specific pub-side files. In such a case, adopting the IABs SafeFrame method is the best recourse. 

What Is A SafeFrame and How Does It Work?

An open-source technology created and released by a group of volunteers from 21 IAB member companies in 2013, SafeFrame got an update in 2014. Yahoo! And Microsoft executives led the initiative, which had volunteers from Google, Disney, CBS Interactive, AOL, Adtech, and Adobe involved. The standard IAB definition for SafeFrame is a “managed API-enabled iFrame that opens a line of communication between the publisher page and the iFrame-contained ad creative”. So, without risking page security, you can overcome iFrame restrictions on advertising and web page interaction, and take full advantage of rich media ads. Publishers run SafeFrame on a secondary domain, and IAB recommends a CDN (Content Delivery Network) be used for optimum performance and availability. This secondary domain is termed an ‘agnostic processing space’, sitting between a web page and ad server. Advertisers can implement JavaScript code in their ads, sending them to many secondary domains belonging to multiple publishers. From there, these advertisements are then funneled to their respective iFrame. There are some advantages to doing this. 

Thus, SafeFrame opens a unified path of communication between ad content and page content. iFrame creates containers around the ad’s content, the API allows interaction between the ad and web page content. 

Benefits of SafeFrame for Publishers 

Greater Control 

SafeFrame isolates the webpage code from the ad code and helps publishers maintain greater control over page layout, also preventing interference from ads. API-enabled SafeFrame also allows publishers to decide what information buyers or third-party vendors can access. 

Greater Efficiency 

Ad units with SafeFrame allow for rich interaction while disabling the page function from breaking due to the ad code. This can boost revenue while keeping down operational costs so you don’t have to outsource this to a developer team. 

User Protection 

Ad slots with SafeFrame enabled to share information with ad content served on API-enabled iFrame. However, it is up to publishers to choose what they want to or don’t want to share. You can withhold sensitive user data like phone numbers or email addresses. 

Enabling SafeFrame in Google Ad Manager 

If you want to reduce the chances of malicious ads being served, activate SafeFrame within the Google Ad Manager. To enable SafeFrames in Google Ad Manager, the ad unit should have the Google Publisher Tag type enabled. 

The four types of ad creatives on offer are 

  1. Custom
  2. System-defined templates
  3. Third-Party
  4. User-Defined Templates. 

For 1 and 3, you don’t have to make changes, as for the creatives, SafeFrames are on by default. If you don’t want it you can disable it by checking the box. For 2 and 4, you follow the same method, enabling/disabling the SafeFrame according to your needs. 

The Future of SafeFrame 

Ever since SafeFrame 1.1 was released in 2014, IAB Tech Lab didn’t release anything significant for a couple of years. SafeFrame 2.0 was launched for a 2-month public consultation, sometime in the middle of 2020. IAB has configured SafeFrame 2.0 to include programmatic ad support. While SafeFrame does execute post the header bidding process, wrappers might get shunned because of a lack of support in the programmatic advertising process. IAB is working with programmatic advertisers to bolster features that might be better compatible with SafeFrame. 


In conclusion, SafeFrame is a big step ahead for digital publishers in terms of maximizing web page ad revenue. Publishers need to implement protocols themselves, and doing so can open up fresh revenue chances, bring down maintenance and operational costs, and hike website security. SafeFrame has benefits that can help digital publishers work better with the latest ad technology. For publishers, their primary concern is to ensure the best user experience for site visitors while ensuring that users interact with ads while keeping personal data secure. SafeFrame offers all the benefits and more in doing so. Read our blog on how to strike the balance between ads and user experience to ensure a smooth experience for users on your website.


Rayomand Engineer

I am a writer based out of Kolkata, West Bengal, and I like to write on tech, politics, travel, music, environment, and wildlife amongst others. I’ve also written scripts for branded content, and also scripts for short films. I’ve been writing for more than a decade and I love it.