IFRAME 中的 Adsense

发布于 2024-10-16 07:40:26 字数 1027 浏览 6 评论 0原文

我已经创建了一个完全基于 AJAX 的网络应用程序,但是 Adsense 似乎无法为 AJAX 交付的内容生成任何相关广告。

为了展示相关广告,我创建了一个 I-Frame,它会显示一个缓存文件,其中包含 html 格式的 AJAX 获取内容的硬拷贝,并在其中包含 adsense.js 脚本。

这是一个示例:

adsenseexample.html 


<html>
<head>
<title>User Cache</title>
</head>
<body>
<div style="height:200px;">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxxxxxxxx";
google_ad_slot = "xxxxxxxxxxxxx";
google_ad_width = 200;
google_ad_height = 200;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
(This is where the cached content is. It's not visible to the user but 
a complete duplicate of what they are viewing. It's in
 plain text with no pictures for faster loading).
</head>
</body>

哪个被加载到 iframe 中:

<iframe src="adsenseexample.html"> </iframe>

有人知道为什么我仍然没有收到任何相关广告。这种方法从一开始就有缺陷吗?

I've created an entirely AJAX-based web app, however Adsense seems unable to generate any relevant ads for the AJAX-delivered content.

In an effort to get to show relevant ads, I created an I-Frame that would display a cache file containing a hard copy of the AJAX-fetched content in an html format and included the adsense.js script inside it.

Here's an example:

adsenseexample.html 


<html>
<head>
<title>User Cache</title>
</head>
<body>
<div style="height:200px;">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxxxxxxxx";
google_ad_slot = "xxxxxxxxxxxxx";
google_ad_width = 200;
google_ad_height = 200;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
(This is where the cached content is. It's not visible to the user but 
a complete duplicate of what they are viewing. It's in
 plain text with no pictures for faster loading).
</head>
</body>

Which is loaded into an iframe:

<iframe src="adsenseexample.html"> </iframe>

Anybody know why I'm still not getting any relevant ads. Is this method flawed from the get go?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

顾北清歌寒 2024-10-23 07:40:27

Google 在其 ToS 中声明,IFRAMES 不得与 Adsense 一起使用。

Google states in their ToS that IFRAMES are not to be used with Adsense.

万人眼中万个我 2024-10-23 07:40:26

嗯,您是否尝试过将参数传递到 iframe src,例如来自引用 http 请求的关键字、描述?然后,您需要将关键字参数和描述添加到元标记中。

Hm, have you tried passing params to your iframe src such as keyword, description from the referral http request? You will then want to add the keywords param and description to the meta tags.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文