How to set AdSense only for visits from search engines.
Since Como Hacer has implemented this new functionality, I take this opportunity to show you all how to do it in a very simple and really effective way. I think that all of us who have a blog or website, we have to think about our recurring visitors and their comfort of usability of our own blog or website, so I encourage you to implement it for these simple reasons:
– We will keep our best users happyRemember that good users are the ones who will give us publicity at any given time, as they somehow feel identified with our site, and they will make us grow with them. The publicity I am referring to can be in the form of posts on their blogs, emails to their relatives or recommendations on twitter, etc. This, in my opinion, is the most important reason to implement this function.
– We will improve the appearance of our blog considerablyYou can't deny that a blog without advertising is better seen than one full of banners and little buttons almost unnecessary for the recurrent user. Keep in mind also, that our regular users are somehow already blinded with our advertising, and it goes unnoticed for them, so it does not generate anything new or beneficial for them and for us either.
– It will improve our eCPMThe less impressions on unnecessary pages, the higher it will be, and the better results it will generate. Let me explain it a little better, we all know that the higher the impressions on our pages where we have the ads, with respect to the clicks on them, the more we will generate better results. eCPM If we now think about the blindness I was talking about earlier, our recurring users are wasted impressions, i.e. our loyal followers, and they are unintentionally lowering our revenue.
– We won't see the ads eitherNormally, every blog administrator does not enter their own site through a search engine, but through some installed application (in my case WordPress Helper, in Firefox), and that will also relieve us of the fatigue of our own ads, so that when we have to optimise or change them, we will be much more impartial about it. At this point, it would also come into play that if we don't see our ads ourselves, we will avoid being penalised by Google for any illegal click made unintentionally, or not...
After this little introduction, I will give you the code that you will have to use for this purpose, it is divided in two parts, this one:
<?php if (preg_match('/q=|search/', $_SERVER['HTTP_REFERER']) ) { ?>
which you will have to put just before the ad code, and this one:
<?php } ?>
which comes right after.
I hope it works for you, as an example you can use this blog, try doing a search for "How To", and then typing the URL of the blog in the address bar of your browser. By the way, if you know of any other reason why we should set AdSense only for visits from search enginesYou can leave it in the comments, greetings!!!!.