Forum Moderators: martinibuster

Message Too Old, No Replies

Stop showing AdSense ads for a certain country

How not to show ads for a certain location

         

Tech4

8:54 am on Aug 5, 2019 (gmt 0)

5+ Year Member



Hi guys!
Can anybody tell me how can I configure my website to stop showing AdSense for chinese visitors? There is a probability that someone from China may try to do harm to me.
Thank you

topr8

9:11 am on Aug 5, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



you need to have access to a geolocation database.

there are various ways of aquiring one for your own server. (both paid and free)

alternatively various companies offer a free API which you can use (usually limited in number of calls per month after which you have to pay)

use this to work out if the user is from china and then use php to not serve the adsense code on your page at the server level.

Dimitri

9:43 am on Aug 5, 2019 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



For PHP , you can use [php.net...]

If you can't use Geo IP db, you can more or less guess visitors from China, by looking at the reverse DNS of their IP and analysing the "accept-language" header field. But this can be too approximation and inaccurate , especially if someone is , on purpose, trying to harm you (he will be "smart" enough to send false information).

If someone is really involved in harming you, he will certainly do it also from other countries.