How To Display Ads Only To Search Visitors | Wordpress


/ Published in: PHP
Save to your folder(s)

Place snippet in functions.php. Works with the Shylock Adsense plugin (http://planetozh.com/blog/my-projects/wordpress-plugin-who-sees-ads-control-adsense-display/)


Copy this code and paste it in your HTML
  1. function scratch99_fromasearchengine(){
  2. $ref = $_SERVER['HTTP_REFERER'];
  3. $SE = array('/search?', 'images.google.', 'web.info.com', 'search.', 'del.icio.us/search', 'soso.com', '/search/', '.yahoo.');
  4. foreach ($SE as $source) {
  5. if (strpos($ref,$source)!==false) return true;
  6. }
  7. return false;
  8. }
  9.  
  10. Call:
  11.  
  12. if (function_exists('scratch99_fromasearchengine')) {
  13. if (scratch99_fromasearchengine()) {
  14. INSERT YOUR CODE HERE
  15. }
  16. }

URL: http://www.scratch99.com/2008/09/avoid-smart-pricing-show-adsense-only-to-search-engine-visitors/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.