Adsense in iframe ?

Is it legal to have adsense ads in iframe ?
The terms only mention that you cannot frame your visitors after they click on an ad link and in the policies state that no Google ad may be placed on any non-content-based pages.

If you put the ads in iframe then probably they won't find any content in order to serve any relevant ads. But, what if you make the ads look outside of the iframe ?

document=parent.document;

I don't think it would violate their terms and conditions but to be sure I send an email to the adsense team:

To the Adsense Team,

I have looked in your terms and the policies on the adsense help site
but I can't seem to find this info anywhere.

I have a site with a very old CMS installed on that does not let me
use anything other than iframe to display the ADS, changing the whole
CMS was out of the question, so I thought about the following solution
with my little experience with javascript.

I would put the following code in a html page and then I would call
this page within an iframe in my existing CMS

<script type="text/javascript"><!--
document=parent.document;
//--></script>
<script type="text/javascript">
<!--
google_ad_client = "pub-xxxxxxxxxxxxxxxxxxxxxx";
google_ad_width = 120;
google_ad_height = 240;
google_ad_format = "120x240_as";
google_ad_type = "text_image";
google_ad_channel = "xxxxxxxxxxxxxx";
google_color_border = "FFFFFF";
google_color_bg = "E6E6E6";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
 src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
the first 3 lines of this code make the parent document available to
the google script so essentially I am bringing the google ad code out of its iframe
borders in order to find content and serve relevant content.

Would the following code be considered code modification under the policies ?

In terms of functionality I tested it and it works, I am going to wait
for your comfirmation in order to use it.

And their answer was:

Hi Giorgos,

Thanks for your message. We apologize for our delay in responding to your
mail.

Please note that you are free to add HTML code or javascript in front or
below the AdSense ad code as long as you do you change the ad code itself.

Your suggested solution therefor complies with our program policies.

For additional questions, I'd encourage you to visit the AdSense Help
Center (http://www.google.com/adsense_help), our complete resource center
for all AdSense topics. Alternatively, feel free to post your question on
the forum just for AdSense publishers: the AdSense Help Group
(http://groups.google.com/group/adsense-help).

Sincerely,

Pim
The Google AdSense Team

Category: 

40 Comments

Well the answer came from adsense support, so I am completelly covered, if you have a similar situation write an email to google support.

But what about...

"No Google ad may be placed on any non-content-based pages."

..and..

"No Google ad may be placed on pages published specifically for the purpose of showing ads, whether or not the page content is relevant."

Isn't the page that's displaying the ad described perfectly by these two points?

Plus, yes, you seem to be covered for the not altering the code, but what about "or change the behavior, targeting, or delivery of ads"

To me this clearly is behavior altering.

What if I want to do the opposite?

I have a page that has very little content. This is where the ads are located. But the content (blog) is on the same page within an iframe. I want the ads to use that content so the ads and the blog, which appear on the same page in the end, to match. Is there code that will actually point it to the iframe source?

Nick
I assume the content in the iframe is not on "yourdomain.com" and therefore the content cannot be accessed using javascript or any other means unless the source iframe includes
<script type="text/javascript">
document.domain="yourdomain.com";
</script>

Thus I would try to just include a relevant enough title on the parent so the adsense can read that and serve related ads.

And as far as I know this is not forbidden by google

Hi,
I wonder if you can help.. I just came across this post and it seems very similar to my problem.
I have the advert in an iframe which has relevant information - but with the standard code it's looking at the parent document which I don't want it to do as it'll come up with competitor adverts.
Can I get it to ignore the parent?

Cheers.

If I understand correctly there is a page (the parent) and inside it you have an iframe (lets call it relevant) with relevant content in which you have the adsense code right ?

well adsense has its OWN IFRAME which is created with javascript. The adsense will actually be looking IN THE RELEVANT IFRAME. and therefore you don't need to worry about a thing ...

I think it also looks at the referrer so I've put it in an iframe, in an iframe on a different site and it seems to work how I want it to now :)

I think using an iframe around the add code is very good solution because often the adsense server is very slow and your site could act slow too (depends on where the add code is placed).

I think it's important that you never cheat, if you use that iframe to organize your ads for the same page/site it should be OK.

btw. There are a lot of revenue sharing sites using some iframe...

No Google ad may be placed on pages published specifically for the purpose of showing ads, whether or not the page content is relevant!?

Hi. I have a similar problem. I dont have much regularly updated content on my main page (lets call it MP), but I have content aggregated via several RSS feeds in my content page (call it CP). I put my google ad code in CP. I then added iframe to MP, referenced to CP. However, google serves relevant ads to CP but when you browse to MP it looks like the ads are not those being served in CP. It looks like it is serving ads based on MP which barely has any fresh content.

A big challenge of putting your dynamic content in an iframe along with relevant AdSense ads is controlling the size of the iframe container. This way, your content iframe looks like part of your page. The problem then would be to reference the document inside the iframe, get its height or width, and adjust the iframe to equal this size. Needless to say, you'd need JavaScript active (and a lot of free time.)

My website contains a street view application, which is an ActiveX control. This control contains information and I would like my visitors to see Ads by google targeted at the same content. However since the application is an ActiveX control the only solution was to fire events from the control with the targeted information. So far okay, and I'm now able to capture this data in the main page.

However if I put the Adsense code in this page it shows ads considering the content of the home page, which is about installation of the control, compatibility issues etc, and hence end up showing completely irrelevant ads.

Therefore I decided to use iframe and to my surprise, as already mentioned by most of the contributors to this post, the ads keep showing up considering the homepage itself. So I used a combination of frames and iframes and now I'm happy to get very relevant ads. The page the displays the ads is an empty page containing only the Adsense code and I pass on all data to this page as a query string. Also the ads keep changing based on user actions, such as change of location and change in items of interest. Although I'm using frames, the Ad when clicked opens up in the same window, so that shouldn't be a cause of worry. In my view, the Ads being shown are related to something the visitors might already be wanting to look at, and hence a useful piece of information.

Now the question is whether this amounts to violation of the TOS? I have already written to Google, but haven't heard back from them. Its just out of helplessness that I have to represent the content from the ActiveX control as part of the HTML Querystring. The Adsense TOS mentions this point: "A site or third party cannot display our ads, search box, search results, or referral buttons as a result of the actions of any software application such as a toolbar." However I am not quite sure if my approach emulates this.

Can someone help me out please?

Abhijit

I would not rely on anyone's approval but google's. They might take a while to answer but their answer is the only "valid" one.

I do understand this subject: How to "lead" the attention of AdSense from one page to another page, but, how to do ?

The main page (MP) of my site contains a "Gun", when visitor clicks it, it fires, the content will then poured out of my server to the visitor, well, maybe you know my meaning --- yes, it works with Ajax, and, I think you may understand, without fire, without content, the content is only presented AFTER visitor fired(click)

Obviously, I should not place AdSense in MP, because, when visitor opens MP, there is nothing there (no clicking yet), that means, AdSense catches nothing there, on other hand, after visitor made a click, and content was presented, AdSense does not notice these change, so, this is the problem: AdSense does not match the content which is presented with Ajax. Let me say: AdSense is static Ajax is dynamic

Well, just you guys said: Put it into iframe ! Farther, I transfer digest of content to the iframe to notify AdSense what it should know. I tried again and again... Huh, AdSense is so "strong" --- it ignores the content of iframe, and, it seems that it goes to the MP directly --- the worse is --- I am sure that it will not make a click---therefore, what it found is:blank (no click, no content) Ah!

Hello I tried this (document=parent.document) and it works great in firefox and safari but in IE 6 and 7, it's giving an error saying Member not found. Any ideas?

to my understanding,,, we can use Iframe in such a way which should clutter the serving page with ads all around and also the page showing ads in iframe must have a bit of content to retrieve the ads and that content should be relevant to the page hosting this iframe.

Will it work with AJAX navigation? I'm trying to get adsense to show proper ads instead of Public Service Ads for days now.. I hope this'll help.
If anyone knows a better solution for AJAX pages - please reply

I have a different purpose I'd like to use this for, and from reading this I think it should work great.
I have a domain that gets 2 or 3 very distinct and different forms of traffic... (some is due to typos etc). So I'd like to split the page into "what are you looking for?" and have 3 different iframes which have content related to the 1 specific (and distinct) topic they are looking for, with an adsense ad mixed in.
If i combined the ads and content into a single page, I assume the adsense would get confused due to the strange mix of technology...
Thanks!

Hi, I look over your site and it’s really good and very interesting the seo on this site is pretty good.thank for inform me Thanks so much Really useful!This site is a very informative knowledge i love this site thanks website admin