简体   繁体   中英

Google Ads not showing when my site is inside an iFrame

I'm building a web application (a web site) which has a feature where you can embed it inside your own web site (using an iframe). So, my app has Google Ads, and sometimes when the it is inside another site as embed (inside an iFrame) it doesn't show Ads, I mean, ads are being rendered, but sometimes that html from google is blank.

I'm concern about the Policy of GoogleAds and to not use iFrames to show ads, but I'm not using iframes to show them, my app is just inside another site as a feature.

My question is: can this be done?, or by that policy I won't be able to show ads on my embed feature?

EDIT 1
This is the content which Google is rendering (inside another iframe of another iframe):

<html>
  <head>
  </head>
  <body style="background-color:transparent" marginwidth="0" marginheight="0">
  </body>
</html>

and also, I getting an error on the console:

Blocked a frame with origin " http://googleads.g.doubleclick.net " from accessing a frame with origin " http://example.com ". Protocols, domains, and ports must match.

where "example.com" is some site that is using my feature

EDIT 2

So, I step at the Network tab of the console, and watch what was calling. Does a GET http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-XXXX .... With 200 OK always, but sometimes it returns just the blank HTML (posted above) and sometimes the actual html with an AD.

One more thing I didn't tell, I'm using the Asynch new Beta method, not the Synch, so I'm thinking of try the Synch and see what happens.

You might try loading the page outside an IFRAME and run network capture on the traffic to/from Google. Explore the response headers - they might be using X-Frame-Options to prevent illicit click activity on ads. There's likely very little you can do about it aside from doing a server-side request and embedding the response HTML yourself. This will dramatically slow down your page loads and might violate your ad agreement.

EDIT: After reading your follow-up testing, it sounds more like your site just doesn't meet the criteria of enough ad campaigns to serve ads with every request. I'd look at Google's FAQs or marketing information to find out how often ads are served or why you might not be getting ads on every request. Remember, the ads are for the benefit of the advertiser and they have good tools to make sure their ads are specifically targeted to the right audience to maximize their return. Your site just might not meet enough criteria to get many ads.

EDIT 2: A quick Google search turned up this FAQ for why Ads might not be showing. They seem geared to why ads don't show at all, not intermittent appearance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM