<?php
if(!strripos($_SERVER['HTTP_USER_AGENT'], 'yandex.com/bots') or !strripos($_SERVER['HTTP_USER_AGENT'], 'Google') or !strripos($_SERVER['HTTP_USER_AGENT'], 'yandex.ru/bots') or !strripos($_SERVER['HTTP_USER_AGENT'], 'yandex.net/bots')){
echo <<<EOD
// тут код вашей рекламы
EOD;
}
?>