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.
Related
Say I have a blog, running with Google Ads.
And I have the total control of that blog. It's not hosted on somewhere else.
Is it possible for me to detect the content of the ads that's been displayed to my readers? For instance, if the keyword Quora is displayed, I want to remove the ads.
I've tried this:
How to get the body's content of an iframe in Javascript?
But I can't get the HTML out.
Is it possible for me to detect the content of the ads that's been displayed to my readers?
This is not possible because of Cross-origin resource sharing (CORS) rules:
Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served. A web page may freely embed cross-origin images, stylesheets, scripts, iframes, and videos. Certain "cross-domain" requests, notably Ajax requests, are forbidden by default by the same-origin security policy.Read full article in the link above.
The Google Adsense Advertising will be created using a JavaScript file which is not on your server.
How to block an advertising (The answer from Google Adsense support)
You can block an advertising in "Ad review center". Citate from official Google Adsense support site:
Ad review center overview
The Ad review center is a feature that gives you more transparency and
control over the ads that appear on your site. When you enable the
Ad review center, you can review individual ads after they're shown and assess whether you want to continue showing them on your pages.
Some important things to know about the Ad review center:
You can find it on the Allow & block ads page in your AdSense account
It supports ads of all targeting types (contextual, personalized, and placement)
You can use its filter and search functions to help you find ads to review and block
It doesn't support all AdSense products
You can only block ads at the product level, not on a site-by-site basis
For help getting started with the Ad review center, see our guide
to reviewing ads.
You could do too:
Block ads by general category: at the site level or at the product level
Important information: each from this links above you can read in your language (e.g. Chinese) too. You can change the language in the bottom of each page.
...detect the content of the ads that's been displayed ... I want to remove the ads
Besides the technical explanation, I don't think hiding of an ad sent from ad publisher for displaying to user is ethical. Because ad publisher will be thinking ad is displaying. Ad owner will be charged for that ad, you gonna earn money from it. In other words, you can't hide the ad after placed to page and displayed.
In my opinion Adsense users have to respect to ad platform's decision about what ad's gonna be displayed. Because agreement between Adsense and user is this.
But if Google Adsense is provide an option for blacklisting for some words, you can use it. I think, that's what you need.
Hope this helps.
P.S.: Maybe Adsense Support can help you about blacklisting. Have you tried to contact them?
Update
I found an article (has a video explanation) about blocking ads based on some rules (URL, ad network etc.)
https://support.google.com/adsense/answer/180609?hl=en
https://support.google.com/adsense/answer/164657?hl=en
I have some html that loads a page into an iframe. This works fine with this page, for example:
https://seandavi.github.io/
However, a page like this:
https://twitter.com/seandavis12/
results in an empty iframe. I suspect this has to do with the page from twitter being rendered in parts using javascript, but I am not sure how to force the page to display in an iframe. Any suggestions?
Environments I have tested: chrome & safari on mac OS
Minimal example:
<html>
<body>
<iframe src="https://seandavi.github.io"></iframe>
<iframe src="https://twitter.com/seandavis12/"></iframe>
</body>
</html>
You won't be able to embed Twitter in an iframe - they have HTTP headers set which your browser sees and prevents the iframe content from being rendered.
If you open your browser console you will be able to see it being blocked:
Twitter will allow you to embed a specific tweet on a page, however, but you must follow their guide on how to do this: https://dev.twitter.com/web/embedded-tweets
Short answer is you can't use iframe/frame/embed/object or any other regular embedding html tag.
Most large company websites that aren't simply static, video streaming (ex. youtube), or informational, will likely have the "X-Frame-Options" set to 'sameorigin'. This is known as a Frame-Killer, disabling iframes/frames/etc from embedding content because they are highly vulnerable to being Click-Jacked.
Check out the security section here in Dev Moz
Oftentimes, high profile companies with desirable endpoints and webpages will provide alternate embedding options or even API's that allow you to safely request access for displaying their resources.
I have a site that uses Google Ads. I don't think I'm doing anything different or unusual, I'm just including the code Google Adsense gave me in my static HTML pages.
However, today I loaded my website and noticed my Google Ads weren't there. I opened Firebug, and I saw this error:
Blocked loading mixed active content "http://pagead2.googlesyndication.com/pagead/show_ads.js"
I found a Mozilla blog post explaining what mixed content blocking is. According to this blog post, this has been a feature since version 23, though I've only updated to version 24 yesterday and noticed my Google Ads not working today.
Although the blog's explanation goes over my head, I think I grasp that mixed content blocking is something to do with potential dangers from pulling content from many different sources. In this case, my Google Ads are coming from a third party, namely Google.
But, this seems a little excessive. Is having a Google Ad really a big security exception?
In any case, is there something I can do to ensure that my Google Ads show, even in a Firefox browser?
This is caused by mixing content with different protocols, i.e. http and https.
https is secure, while http is not. So if you have a page that is called with https://domain.com and it uses a file http://domain.com/filename the latter is non-secure!
Solution: either use https or http for everything throughout your site. Don't mix them.
AdSense use javascript to catch the keywords of current page to display relevant ads. But I was recently noticed that it will show ads related to my browsing history too. It seems that the javascript code can read my cookie (in general I mean, e.g. list of domains visited) to display relevant ads.
Is it practically possible to read cookies of a visitor?
No, it isn't possible to do so directly due to the same origin policy. (If it were possible, then you could make a page that stole the session of anyone on any domain!)
However, many websites include code from ad providers (read Google) on their page -- so that Google knows that you have visited website X because website X allows Google code to run when someone visits it. When you later visit website Y and it asks Google to display some ads on its behalf, what happens is no mystery.
Google knows all.
According to Yahoo's "Best Practices for Speeding Up your Site", the pros for using iframes:
Helps with slow third-party content like badges and ads
Download scripts in parallel
but the cons are:
Costly even if blank
Blocks page onload
I want to use an iframe to load ads using the technique mentioned on this site:
http://meanderingpassage.com/2007/08/15/keeping-javascript-widgets-from-controlling-your-blog/
Does using this technique mean that as soon as the html contents requested by the iframe are returned to the client, it will load the ad script, potentially blocking the rest of the page's rendering and downloading? Or will the iframe request get processed concurrently while rest of the document is downloaded and rendered?
I'm, however, not looking for a discussion on the philosophy of whether ads are good or bad.
I'm not quite sure why the Yahoo list says "Blocks page onload". IFrames load independently of the parent page, particularly if the iframe content is in a different domain than the main page. The "Blocks page onload" seems contradictory to the pros, both of which are due to concurrency of the iframe load.
Now, if you have an iframe that is loading something from the same domain name as the main page, that may fall into the browser's connection limit per domain, and therefore impact how quickly the main page can download its content. But if the iframe URL is a different domain, it should get its own connection limit per domain.
The biggest pro for iframes is security isolation. When you load third party script into an iframe, you don't have to worry about the third party script taking over your page and scrawling graffitti all over the place, or stealing user data from your script variables.
The biggest con for iframes is also the security isolation. ;> The brick wall that protects you from third parties also makes it very difficult to communicate / share info between parties on the same web page.
Rendering of the interior iframe is processed concurrently with the exterior page. Any javascript inside the iframe will only prevent loading of the contents inside the iframe.
Edit: also, I just noticed I answered your previous question on this subject, and as explained there it's possible to trigger iframe loading in javascript whenever you wish (e.g. after the rest of the page is loaded).
If you're putting in ads, you probably want to use AdSense (or at least test it out). The Google AdSense robot doesn't like iframes:
https://www.google.com/support/adsense/bin/answer.py?hl=en&answer=10035