Google Adsense CloudFlare issue and solution

I have seen in my forums queries about drop in Google Adsense CTR after using CloudFlare.Many people do not use free content delivery network services of CloudFlare fearing drop in their Google Adsense earnings.

How Google Adsense works?

Google Adsense delivers ads based on
1.Content of your page (contextual)
2.Geographical area of visitor (Geo Targeted)
There are other ways to deliver matching ads on your webpage.But these two are related to this post.

How CloudFlare works?

CloudFlare works as reverse proxy.It stands between your website and the visitor.The static resources of your website (images,videos,css,js) gets loaded by CloudFlare.This is the way it makes your website fast.

How CloudFlare impacts Google Adsense?

As mentioned above CloudFlare stands between your website and visitor.So Google Adsense sees CloudFlare as traffic origin instead of the visitor.The ip address of CloudFlare server is visible instead of the visitor ip address. Due to this Google displays ads relevant to location of CloudFlare server instead of real visitor location.For example if original visitor is from India and CloudFlare server catering the request is in USA then visitor will see ads relevant to visitor of USA.

This wrong geo targeting of ads result in less CTR and hence less earning from Adsense.You can see ads in language other than English (assuming visitor is from English speaking region) CloudFlare server catering the request is in other region.


The solution approach is getting real ip address (that is ip address of visitors) instead of CloudFlare ip address.There are different approaches to do this depending upon web server you are using.Read this post for details of the solution for Apache web server and Nginx web server.

CloudFlare rocketloader issue with Adsense

RocketLoader is advanced asynchronous JavaScript loader.It can speed up website ten folds.But this loader is not compatible with Google Adsense.The reason is not very clear.But in my opinion RocketLoader loads the JavaScript from its servers.This is the very reason of incompatibility.
Below are the solutions in order of performance

Complex customization solution

In this method you need to set Rocket Loader mode to Manual.So the JavaScript code used on your website will not use this until and unless specified to do so.But this becomes complex if your JavaScript gets loaded from plugin like Disqus etc.In this method you can load compatible scripts using loader by specifying below command

first line of code before modification

<script type=”text/javascript”>

Above line should be changed to

<script data-cfasync=”true” type=”text/javascript”>

No customization solution

If you are not comfortable with above two methods then you can try this one.This method is the simplest but is worst in terms of performance.In this method you need to disable Rocket Loader by selecting Off.Thus your website will not be able to use benefit of this loader but you can still use free content delivery network facility of CloudFlare.

In case you have used any other method or having issues then please share your thoughts.

29 comments Google Adsense CloudFlare issue and solution

  1. Please follow the solutions mentioned in this post. It works. Nginx is web server and can be used instead of Apache

  2. Hi Esha, I am facing the same problem. Recently i switched to CloudFlare and I have seen a decrease in Google Adsense revenue. Rocket loader is disabled. The other solution to configure CloudFlare with Apache server work? Should I ask hosting to install mod_cloudflare? And what is Nginx?

  3. Hi,
    I have used Cloudflare about 5 days (disable Rocket loader, disable javascript minify), 2 days had no problem. But then my earnings were reduced by about 50 i disabled it for my blog. I think it is problem due to Cloudflare filter visiter ip address.

  4. I have not used MaxCDN so unable to comment.Do check if it is impacting Adsense ads in any way.Like is correct ip address being passed to adsense

  5. Hai
    I’m facing same issue with MaxCDN. I noticed around 50% drop in adsense earnings with MaxCDN enabled. Do you know any solution for it?

  6. You can make it manual and make changes in JS files you want to load with rocketloader

  7. R u sure we can use cloudflare rocketloader enabled for google adsense ads. No risk? As google adsense policies says no modifications with ad code. Pls explain n reply

Leave a Reply

Your email address will not be published. Required fields are marked *