As we all know that regular visitors don’t click on ads, around 90% folks who click on ads are coming from search engines.
Also for fact that Google pays more if your click-through rate (CTR) is higher, Google’s “smart pricing.” Being smart priced means that your click-through rate (CTR) is low and the money you earn per click is divided by between 2 and 10. For example, if a click would normally earn you $1.00, with smart pricing it could earn you as little as $0.10. Painful, isn’t it? Happily, this solution displays your AdSense ads to search engine visitors only, which means more clicks and a higher CTR.
For WordPress Users:
Note: Do take backup of your theme before you try this.
01. Go to Appearance => Editor.
02. Then choose functions.php file from right hand side and add below code:
function scratch99_fromasearchengine(){
$ref = $_SERVER['HTTP_REFERER'];
$SE = array(‘/search?’, ‘images.google.’, ‘web.info.com’, ‘search.’, ‘del.icio.us/search’, ‘soso.com’, ‘/search/’, ‘.yahoo.’);
foreach ($SE as $source) {
if (strpos($ref,$source)!==false) return true;
}
return false;
}
$ref = $_SERVER['HTTP_REFERER'];
$SE = array(‘/search?’, ‘images.google.’, ‘web.info.com’, ‘search.’, ‘del.icio.us/search’, ‘soso.com’, ‘/search/’, ‘.yahoo.’);
foreach ($SE as $source) {
if (strpos($ref,$source)!==false) return true;
}
return false;
}
03. Now, paste this code anywhere in your theme, where you want to display your adsense and they will appear only if the visitors are coming from search engines.
if (function_exists(‘scratch99_fromasearchengine’)) {
if (scratch99_fromasearchengine()) {
INSERT YOUR CODE HERE
}
}
if (scratch99_fromasearchengine()) {
INSERT YOUR CODE HERE
}
}
04. Save the files and you are done.
For Blogger Users:
Note: Do take backup of your template before you try this. Only try this if you are familiar with blogger codes.
01. Go to Layout => Edit HTML, click on Expand Widget Templates and before</head> add Below code in to it:
<script type=’text/javascript’>
//<![CDATA[
var ref = document.referrer;
var se = new Array('/search?', 'images.google.', 'web.info.com', 'search.', 'del.icio.us/search', 'soso.com', '/search/', '.yahoo.');
var sevisitor = false;
for (var i = 0; i <= se.length-1; i++) {
if (ref.indexOf(se[i])!== -1) {
var expiry = new Date ();
expiry.setTime(expiry.getTime() + 3600000);
document.cookie = "sevisitor=1; expires=" + expiry + "; path=/; domain=scratch99.com";
sevisitor = true;
}
}
//]]>
</script>
//<![CDATA[
var ref = document.referrer;
var se = new Array('/search?', 'images.google.', 'web.info.com', 'search.', 'del.icio.us/search', 'soso.com', '/search/', '.yahoo.');
var sevisitor = false;
for (var i = 0; i <= se.length-1; i++) {
if (ref.indexOf(se[i])!== -1) {
var expiry = new Date ();
expiry.setTime(expiry.getTime() + 3600000);
document.cookie = "sevisitor=1; expires=" + expiry + "; path=/; domain=scratch99.com";
sevisitor = true;
}
}
//]]>
</script>
Note: In the document.cookie line, you must change scratch99.comto your own domain!
02. Now put below codes where you want your ads to be displayed:
var results = document.cookie.match ( ‘(^|;) ?sevisitor=([^;]*)(;|$)’ );
if (sevisitor == true || results[2] == 1) {
<script type=’text/javascript’>
//<![CDATA[
var results = document.cookie.match ( '(^|;) ?sevisitor=([^;]*)(;|$)’ );
if (sevisitor == true || results[2] == 1) {
var adsenseString = "<div style=\"float: left;\">\n";
adsenseString += "<script type=\"text/javascript\"><!–\n";
adsenseString += "google_ad_client = \"pub-xxxxxxxxxxxxxxxx\";\n";
adsenseString += "google_ad_host = \"pub-xxxxxxxxxxxxxxxx\";\n";
adsenseString += "google_ad_slot = \"xxxxxxxxxx\";\n";
adsenseString += "google_ad_width = 336;\n";
adsenseString += "google_ad_height = 280;\n";
adsenseString += "//–>\n";
adsenseString += "<\/script>\n";
adsenseString += "<script type=\"text/javascript\"\n";
adsenseString += "src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">\n";
adsenseString += "<\/script>\n";
adsenseString += "<\/div>\n";
document.write(adsenseString);
}
//]]>
</script>
if (sevisitor == true || results[2] == 1) {
<script type=’text/javascript’>
//<![CDATA[
var results = document.cookie.match ( '(^|;) ?sevisitor=([^;]*)(;|$)’ );
if (sevisitor == true || results[2] == 1) {
var adsenseString = "<div style=\"float: left;\">\n";
adsenseString += "<script type=\"text/javascript\"><!–\n";
adsenseString += "google_ad_client = \"pub-xxxxxxxxxxxxxxxx\";\n";
adsenseString += "google_ad_host = \"pub-xxxxxxxxxxxxxxxx\";\n";
adsenseString += "google_ad_slot = \"xxxxxxxxxx\";\n";
adsenseString += "google_ad_width = 336;\n";
adsenseString += "google_ad_height = 280;\n";
adsenseString += "//–>\n";
adsenseString += "<\/script>\n";
adsenseString += "<script type=\"text/javascript\"\n";
adsenseString += "src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">\n";
adsenseString += "<\/script>\n";
adsenseString += "<\/div>\n";
document.write(adsenseString);
}
//]]>
</script>
Note: You’ll have to replace the xxxx’s with the appropriate numbers from your Adsense code and you’ll have to change any other details (such as ad width and height if you’re not using a large rectangle).
03. Save Template. You are done.
If you are finding blogger code implementation hard, then try our Blogger to WordPress Service
Scripts Sources:
How to Display Ads Only to Search Visitors
How to: Display AdSense to search engine visitors only
10 Killer WordPress Hacks
Show Adsense To Search Visitors Only – On Blogger
Adsense within an IFrame
How to: Display AdSense to search engine visitors only
10 Killer WordPress Hacks
Show Adsense To Search Visitors Only – On Blogger
Adsense within an IFrame
That concludes this simple and useful tutorial. Hope you like it.
No comments:
Post a Comment