How To Hide Adsense From Social Traffic

How To Hide Adsense From Social Traffic

Read on to find out How To Hide Adsense From Social Traffic from Stumbledupon, Digg, Technorati, Etc. The secret is to add a little JavaScript around your Ads, so that they will only be displayed if the visitor comes from a search engine. To see this in action, visit this site via search engine and an Adsense ad will replace the banner on top of this post

Update – PHP Alternative

  • If you prefer to code this trick using PHP then do this:

Insert this code where you want the ad to appear
<?php include ('incl_adsense.php'); ?>

– where incl_adsense is this file; gooad.php is your Adsense AD, and amazonad.php is an alternative ad to Adsense for non-search customers.

<?php
function searchengine(){
$ref = $_SERVER[‘HTTP_REFERER’];
$SE = array(‘/search?q=’, ‘images.google.’, ‘.google.’, ‘search.’, ‘del.icio.us/search’, ‘soso.com’, ‘/search/’, ‘.yahoo.’);
foreach ($SE as $source) {
if (strpos($ref,$source)!==false) return true;
}
return false;
}
if (function_exists(‘searchengine’)) {
if (searchengine()) {
include(‘gooad.php’);
}
else include(‘amazonad.php’);
}
?>

  • Save Bandwidth:

I find that all these ‘plugins’ tend to slow WordPress down too much at loading, so there is a good case for using this PHP alternative rather than a plugin to hide Adsense from social traffic

  • Please notice that where the Google ad script is included in PHP you need to ‘Escape’ all the double quotes – like this: script=”ad text” must be edited to read script=\”ad text\” and change any ‘slanted’ quotes like ‘ and “ to vertical quotes like these "'
  • Why Hide your Ads?Hide Social Traffic


There is plenty of authority for hiding your ads from social traffic so you can increase your adsense CTR (from Grizzly’s Make Money Online Blog) and not have a lot of “views” that won’t ever get clicked. Here’s a direct quote from Vic Franqui; “One last thing – if you get a lot of social media traffic don’t run adsense. Only use adsense if you draw targeted search engine traffic”.

  • How It’s Done.

So now you can run Adsense even if you get masses of Social traffic – If you run a WordPress blog you can use the ozh who sees ads plugin, but there is no easy plugin for Blogger or your normal website, so I have made up some JavaScript to use anywhere you want to show your ad to search traffic.

  • Wrap the ad in an “iframe”

Some ads like Amazon have the code already wrapped in an iframe, so all you need do is wrap this (green) Script,  around your ad code (red). The script detects if the referrer is Google, Yahoo, etc and displays the ad.

<script type="text/javascript">
<!––
var myArray = [];
myArray[0]= '/search?';
myArray[1]= '.yahoo.';
myArray[2]= 'search.';
myArray[3]= '/search/';
myArray[4]= 'images.google.';
for(var i=0;
i<5;
i++) {
if (document.referrer.indexOf(myArray[i]) > -1)
{
//––>
document.write('
<iframe src="http://rcm.amazon.com/e/cm?t=youraccount-20&o=1&p=26&l=ur1&category=computers_accesories&banner=1SKRXV416ZYVKCEGXQR2&f=ifr" width="468" height="60" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe>');
}}
</script>

Substitute your ad code for the code in red above. This will work with any code that is completely wrapped in an iframe.

  • Display Google Adsense

This can be a problem because Blogger, for instance, will overide some scripts you include. The answer is to source the Adsense code from an outside file.  Pop your Adsense ad in a plain html file (adsense.htm); upload it to some place you can access; and call it as the source (src) of an iframe –

<script type="text/javascript">
<!––
var myArray = [];
myArray[0]= '/search?';
myArray[1]= '.yahoo.';
myArray[2]= 'search.';
myArray[3]= '/search/';
myArray[4]= 'images.google.';
for(var i=0;
i<5;
i++) {
if (document.referrer.indexOf(myArray[i]) > -1)
{
//––>
document.write('
<iframe scrolling="no" style="width:125px;height:125px;" frameborder="0" src="http://YourSite.com/adsense.htm" marginheight="0" marginwidth="0"></iframe>');
}}
</script>


Edit the above URL (dark red text) to point to where you uploaded your adsense.htm file, and adjust the width, height to match your Adsense ad

  • Just Copy and Paste

There you go – paste one of the above sets of script into your web page wherever you want the ad to appear. With Blogger, use an HTML/JavaScript Gadget, or else paste it directly into the HTML template in your header if you prefer.

  • Try it and See for Yourself…..

Click on Site Synergy with Keyword Coherence for my Key Word Coherence site and you will see no ads, but Google (or Yahoo) for keywordcoherence and click on the SERP link to that same site and you will see that a banner ad in the header from Amazon and a Google ad in the side bar have appeared, because the referrer was a search engine.

  • Tips to the Wise….

Be sure to edit the iframe dimensions to match your ad and check that your edit program paste function didn’t put left and right quotes into the script instead of plain quotes. Get that right and you will have learned how to hide Adsense from social traffic!

Tweet

How To Monetize Your Site

This entry was posted in Monetize Your Site, SEO and tagged , , , , , , , , , , , . Bookmark the permalink.

189 Responses to How To Hide Adsense From Social Traffic

  1. Ken says:

    I really enjoy it! Thanks Rhys! 🙂
    Btw, the link is not working, [edit = now fixed – Rhys]I was using the “view page source” to get the link to your How to hide adsense post.

    Again, thanks for your hard work to code for us! Really appreciate it.

    Ken´s last blog post..Acer X960 and Acer DX650 VGA HSDPA Smartphone Leaked

  2. JD says:

    This is a very helpful. I don’t necessarily need to use this for adsense but I had other things I want to show or not show based on where someone comes from. Mainly I am concerned about showing pictures and other content on a site I have. I’m not a great computer program but I may be able to sue what you have here to solve my problem.

    Thanks!

    JD´s last blog post..Australia’s Kwongan Heathland

  3. Rhys says:

    @JD

    You are on to it! You can adapt this code to display whatever to whomever – just change the referrer criteria to whatever you like………..

  4. Pingback: Show Adsense using Javascript and Hide it from Social Traffic…

  5. hello i try to use your code but i get some error maybe smart quote issue i am not sure can you please help me i have got tons of traffic from google image search i want traffic but i do not want to show adssense ads so is it possible to get code without smart code issue

    jessica mcbrown´s last blog post..did elisabeth hasselbeck have her baby

  6. Adsense Tips says:

    Great post!
    I’ve been looking for this for some time now! Some good way to do this. Another solutuon would be by doing it in the backend in php for instance, but this works just as well probably

    Anyways, thanks again.

    Keep ehm coming

    Adsense Tips´s last blog post..Simple Trick that can Double your adSense CTR

  7. Rhys says:

    @Jessica

    Here is the code with the smart quotes removed and edited to hide the ads from Google Images. Copy and paste it to your page.

    <script type="text/javascript">
    <!–
    var myArray = [];
    myArray[0]= '/search?';
    myArray[1]= '.yahoo.';
    myArray[2]= 'search.';
    myArray[3]= '/search/';
    for(var i=0;
    i<4;
    i++) {
    if (document.referrer.indexOf(myArray[i]) > -1)
    {
    //–>
    document.write('<iframe src="http://rcm.amazon.com/e/cm?t=youraccount-20&o=1&p=26&l=ur1&category=computers_accesories&banner=1SKRXV416ZYVKCEGXQR2&f=ifr&#34; width="468" height="60" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe>');
    }}
    </script>

    P.S., Don’t forget to change the ad code to your own ad code!

    Rhys´s last blog post..CommentLuv Guarantees Premium Keyword Backlinks

  8. That is a great idea. I wonder how it effects ads shown on site if they are in a frame. Could you make ads show different ones than keywords on page they are shown.

    Black mold removal´s last blog post..Mold removal.

  9. freestuff says:

    I wonder if putting ads in iframe would effect ads shown. How does it know what keywordds or ads to show.

    freestuff´s last blog post..Freeloans

  10. It is normally more difficult to get traffic from Social Media to click on the adsense therefore greatly reducing the CTR..i thnk PHP is good… I use php on my blog and in my website also..

  11. Rhys says:

    @Freestuff

    the ad is triggered by the calling page, not the iFrame, so the content is relevant to the page that called it!

    😀

  12. Hi

    Well I´ve a few blogger blogs and this code is usefull for that purpose.

    I will try on other free blogging plataforms if it works ..

    Cumps

    Ganhar Dinheiro Net´s last blog post..Ganhar Dinheiro Facil na Internet

  13. T1 internet says:

    I did not know you could show adsense in frames. Sounds like a great idea to show ads to the traffic type you want.

  14. Egipt says:

    Revelation. You are great for me!

  15. Broadband says:

    Never knew this was possible. Thanks for the information.

  16. Wuhan says:

    Hello:

    I think this is a good idea. I hope after you provide us with more information. Thanks for the idea and code.

  17. You should show your adds to as much traffic as possible, limiting adds would just your overall income.

    At the last Google Adsense online live chat I asked the experts about this and they pretty much said your just hurting yourself by not showing adds as much as possible.

    Though it is true the ppc is slightly higher for people coming directly from search you will lose in the end with just less clicks and less revenue at the end of the day.

    The advice they gave was show as many adds as possible to make the most money.

    FriendTek.com´s last blog post..Tell Me Why Anchor Text Is Influential To Getting Organic Traffic?

  18. Great article. Thanks for making the code for both wordpress and blogger. I have a old blogger blog with adsense and i think it is smart priced because of some of the traffic. I have to try it because it seems to make alot of sense.

    Phone service´s last blog post..Broadband phone voip service.

  19. Rhys says:

    @FriendTek

    Of course they would advise showing it to all, that is their vested interest. What we are advocating here is NOT showing it to social traffic that doesn’t ‘click’ because if your CTR is too low you will get SMART PRICED!

    Enough of us have tested this theory to prove it works. What is the use of going for a few more clicks from social traffic if your return per click drops to one or two cents? My returns now range from 25 cents to $2+ per click since I put this in place. Try it before you knock it. The bottom line is revenue, not clicks.

    Rhys´s last blog post..Monetize Your Site

  20. very interesting info, t
    hank you for sharing with us

  21. Tedy says:

    This is nice post. When I search in google using term “biznz.org” with Internet Explorer, I see the adsense here. But, if I try to search “biznz.org” in google using Mozila, I do not see the adsense here.

    I think the script works only in IE, but not in Mozila. Is it right? I really thanks if someone can give me the script that can works in IE and Mozila.

  22. Rhys says:

    Hi Tedy

    The code works with search engines only, that is the purpose of it. If you search for a keyword off my site: E.G, “How To Hide Adsense From Social Traffic” using the Mozilla search bar, you will get biznz.org listed as 1 on the SERP, which when clicked, will display the ad. This works AOK, and is the intended use of the code. Typing in a URL [biznz.org] defeats the purpose of the code.

    Anyone searching br URL wouldn’t be shown the ad because we are trying not to display it to anyone except keyword searchers.

    8)

  23. Great post. Most people never realize how they get smart priced let alone how to stop it. I like the fact you tell them about social sites everyone thinks they help make more money but sometimes they hurt. Just shows you search traffic is always the best traffic.

    Best etf funds list´s last blog post..Gold etf.

  24. caleb34 says:

    hey, great post. I have noticed my ctr is not near as good from social sites

  25. Great trick, and one that’s easy enough to implement that even I may be able to handle it 🙂

    Thanks for posting this!

    Lee

    Lee, Blogger’s Workshop´s last blog post..Does Your Blog Educate and Entertain?

  26. I love the ozh who sees ads plugin that I use on my word press blog. But I also have a Blogger site & this post of yours was exactly what I was looking for!

    daily cell phone news´s last blog post..Smartparts 8″ LCD Picture Frame

  27. This is a very good idea. higher CTR from adsense will be achieved if you hide your ads like you have outlined. Thank you for the read.

  28. Today there are several ways to get traffic to your website. Social media traffic is one of them does traffic from stumbleupon, facebook, myspace, digg etc will help convert better for affiliate marketing.

  29. I did not know you could show adsense in frames. Sounds like a great idea to show ads to the traffic type you want.

  30. Ruud says:

    The script doesn’t apear on my blog.
    I don’t know were the mystakes is.

    Ruud´s last blog post..DIARREAS EN NIÑOS MENORES DE 5 AÑOS

  31. powertools says:

    Great post. I have to try this i get alot of image traffic and have low ctr. I seen some sites that have adsense ads for search terms that people go to site for how do they make that work. Site could be about baking but found in google for ovens and shows ads for oven not sure how they do it it seems like more people would click on the ads related to search they found site with.

    powertools´s last blog post..Router bits.

  32. Great idea. I seen earings go down when i subitted to social traffic sites so this makes alot of sense. I will try the codes you use thanks i like the fact you show how to do it.

  33. wakacje says:

    Very interesting article and idea – increase CTR!

  34. This looks like a good idea. I know some traffic has very low click thru rates and it does hurt your earnings. I have to try the codes for social and image sites and see how it effects my click thru rates and earnings. Thanks i never seen the codes for this before.

    digital photography´s last blog post..Free photo and photography sites

  35. freebees says:

    Thanks i will have to see if this works. I know i was getting low paid ads on site and looked at ads and blocked them so far. It works good and i earn more but this sounds easier than looking at what ads all the time.

    freebees´s last blog post..datingservices

  36. I think you must show your add as much as possible, because more people will click. Increasing CTR with letting less people to see your ad it is not a good idea in my opinion.

  37. exon mobil says:

    That sounds like a good idea. I have to find some place i can use for the code that allows it. Blogger will not so i need to find a free place that lets me call the ad up and loads fast.

    exon mobil´s last blog post..Ford motor company stock.

  38. Thanks for the info, was looking for something like this.

  39. I’m wondering why you prevent hiding adsense from social traffic hence it doesn’t ask money from the site owner when displaying the adsense.

    I guess this would be favorable to Adwords since every click is money!

    Cathy from How To Make Money Fast Online´s last blog post..Free Twitter Guide – Step by Step Money Making Formula

  40. I like this idea. I see code for blogspot but not sure they work on that blog. I know they are hard to add scripts or change things so i might try it on a site just to see how it works. WordPress it works great on and ctr will go up so earnings should go up also.

    houston web hosting´s last blog post..cheap web hosting uk

  41. Thanks i will have to try this code. I do see some traffic from social sites and it does not convert. This sounds like it will help click thru rate alot.

  42. freeloan says:

    Thanks for the code for blogger i have to try it. I know some codes do not work on some of the blogger templates so i will see if this one does. Not sure why some work and others do not it seems to depend on the template you choose.

  43. Anna says:

    Doesn’t placing iframe around the ads put your adsense account at risk? Don’t want Adsense to terminate my account… I myself am struggling with low ctr because I get often found through image search. Contemplating on using your code. It works on a regular website and not just Blogger/Wordpress, right? Thanks for your article!

  44. Rhys says:

    Hi Anna –

    The ‘spirit’ of the TOS is not compromised by using this iFrame, and there have been no reports of G getting upset about it.

    Use this code on any HTML page!
    😀

  45. coolsites says:

    Thanks i have to try this idea. I seen some people say searches from certain countries also lower earnings. I know some use a script or code like this to not show ads to certain countries so thier click thru rate is higher.

  46. Thanks that is a good tip. I did not know you could put adsense in a frame and it would still show ads related to site.

  47. Is the code above intended to hide adsense from Social Traffic applicable for blogspot platform?

  48. Thanks for the codes. I have a site i used adsense on and it never paid me much. I did notice most traffic was not search engines so it sounds like that is the reason earnings where so low. I will have to try your idea and see if it helps my earnings.

  49. Rhys says:

    @ Cathy, Yep – Read the post – (Display Google Adsense)
    😀

  50. Brad Dohack says:

    I’m not really sure why you would want to remove adsense from social media traffic. Don’t you want those clicks too?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.