所以我在印度有一个仇恨者,他轰炸了我的adsense广告单元。幸运的是,我没有被谷歌禁止。我使用iq blockcountry插件(wordpress)阻止了印度访问者访问我的网站。现在,我想知道是否有任何程序,以便我可以允许印度访客,但对他们隐藏adsense单元?我不想因为一个愚蠢的人而阻止所有的访客。
拦截特定国家/地区的广告单元
1 个回复
最合适的回答,由SO网友:woony 整理而成
一个快速的谷歌搜索给了我这个。此插件似乎具有以下功能:http://wordpress.org/extend/plugins/ad-injection/faq/
How can I show different ads to people in different countries?
If you install the Country Filter plugin (with the IP database) then you can use the following code in the direct ad insertion modes. This will not work in mfunc mode!
<?php if (function_exists(\'isCountryInFilter\')) { ?>
<?php if(isCountryInFilter(array("uk"))) { ?>
UK advert
<?php } else { ?>
Global advert
<?php } } ?>
--因为以上是一个付费选项。你能做的就是。使用remote\\u addr获取访问者ip
$ip = $_SERVER[\'REMOTE_ADDR\'];
接下来,请使用可以为您提供此信息的networkservice,或者您可以使用可用的数据库自己为其创建函数。---最简单的解决方案是geolocation
, 但你的用户必须同意这一点。
结束