I want to block my AdSense ads from showing to users in specific countries. The low payout countries are making my average CPC drop. I don't want to show my ads at all to users in those countries.

How I can block my ads? I already know about DFP, but I'm hoping there is another way.

  • CPC from one country did not affect to another country CPC. You have misunderstood about Google advertising.
    – Goyllo
    Commented Feb 17, 2016 at 7:21
  • What are is your site built with? Is it code that you can modify yourself? Commented Feb 17, 2016 at 10:41
  • I can't remember how the interface of adsence looked like but I am pretty sure you can't do that, basically when you post an advertisement on adwords you target to few specifics like country, age and etc.. And this is why you can't modify it, for example I might choose to target UK and you can disable it so if my ad shows on your website it wouldn't show for the country I have targeted. But if there is a solution for this I'm sure it's in your adsence preferences I guess there is an option to filter countries and you won't get ads which are targeting them but can't as I am banned from adsence.
    – knif3r
    Commented Feb 19, 2016 at 11:03
  • It's all money in the pot. If an African click is worth less than an American click, so what? Commented Jan 30, 2018 at 11:03

4 Answers 4


First you have to understood google terms and conditions for cpc in that you cpc doesn't affect you click for low paying country. Your cpc is same for all countries that you have mentioned.

If your not using google polices to place Ads on your website such as DFP then you can make your Ad only for particular countries like all in DFP you can increase your ad revenue by placing the Ad that you think okay and you decide the cost of the particular place on your website without Google intervention.

You can also do it with .htaccess and that will work with static sites, but you'll have to do some work to identify all the IP ranges involved. Be sure not to block your own.


You can use GeoIP database and some GeoIP library for the language your site is build with to detect the country and then don't include the adsense code if visitors country matches one you don't like.

But there really is no point in doing so. Artificiality increasing CPC by blocking poorly performing countries won't have any positive impact on your total earnings, probably a bit of the opposite. What's the point of higher average CPC if you get less clicks and less money?


This is not the place to provide code, but you could wrap your adsense code in some logic to detect the country of the visitor and not display for whichever countries you want to not see the add.

But really, so your CPC drops...why is that a problem except in your head? You still receive the same total payout don't you?.

  • 1
    Answers here often include code. If you have the code to do this, please feel that you can include it in your answer. Commented Oct 17, 2016 at 11:41
  • I actually meant "don't expect someone to do the coding for you" :P
    – Steve
    Commented Oct 18, 2016 at 2:19

You can use an ad server such as Google Doubleclick for Publishers (DFP) Google makes DFP available for free for most websites.

To use DFP, you have to change the JavaScript tags that power your ads. You would need to set up your ad slots (inventory) in DFP, and generate new JavaScript code to include on your site. Unlike AdSense, DFP uses a block of code in the head of the page in addition to the code for each ad slot.

By default, DFP shows AdSense ads for every slot. DFP allows targeting by demographics. You could set users from various countries to not see ads, or to see "house ads" that advertise other portions of your own site.

Unfortunately, DFP has a pretty steep learning curve. It is much harder to use than AdSense. It used different terminology for the things that AdSense does.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.