如何在不超过3个广告限制的情况下在每个隐藏的JQuery div中放置Adsense广告 [英] How can I place an Adsense ad in each hidden JQuery div without exceeding their 3 ad limit

查看:70
本文介绍了如何在不超过3个广告限制的情况下在每个隐藏的JQuery div中放置Adsense广告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含大量内容的单个html页面,但是大多数内容都是隐藏的,只有当用户单击侧边栏中的链接并且JQuery动态更改正在显示的内容(div)时才会显示。我想要显示Adsense广告,无论内容的哪一部分正在显示,但这意味着将adsense广告代码添加到每个隐藏的div中。这不会是一个问题,除非它意味着我的单个HTML页面会将相同的Adsense代码粘贴到80个不同的地方,我很确定这是针对Google Adsense TOS的。

I have a single html page with a large amount of content however, most of the content is hidden and only gets displayed when the user clicks a link in the sidebar and JQuery dynamically changes the content (div) being shown. I want an Adsense ad to be shown no matter which part of the content is being displayed but this would mean adding the adsense ad code into each hidden div. This wouldn't be a problem except it would mean that my single HTML page would have the same Adsense code pasted into 80 different places and I'm pretty sure this is against the Google Adsense TOS.

无论当前显示哪个div以及我只需要添加Adsense代码ONCE,最好,最简单的方法是让广告显示在同一个地方!

What would be the best, easiest way to have the ad shown in the same place no matter which div is currently being displayed and where I would only need to add the Adsense code ONCE!

BTW,使用数据库动态生成我的内容将是一个解决方案,但我担心在这种情况下它不是一个选项。有什么建议吗?

BTW, Using a database to dynamically generate my content would be a sollution but I'm afraid its not an option in this case. Any suggestions?

推荐答案

你可以在你希望广告出现的地方放置占位符div,然后动态地放置它,就像这样:

You can have "placeholders" divs where you want the ad to appear and then put it dynamically, like this:

adsensecode = '...';

function div_show($div) {
    $div.find('.adsense_placeholder').html(adsensecode);
}

function div_hide($div) {
    $div.find('.adsense_placeholder').html('');
}

这篇关于如何在不超过3个广告限制的情况下在每个隐藏的JQuery div中放置Adsense广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆