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. Rhys says:

    @Brad –

    The logic is simple – search traffic is motivated: therefore likely to click an ad – social traffic is just that, social, just looking to be entertained.
    Research shows that social traffic doesn’t click ads; and also that Adsense penalises you with smart pricing for low quality traffic.

    😀

  2. @Rhys: You don’t seem to understand what Tedy was tring to make you see when he said “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.”
    This is not a keyword issue but one that has to do with the browsers. Some browsers simply don’t support the script version. I keep my fingers crossed and await a solution from Stephen Cronin, RT Cunningham or you, that makes the php version compatible with cache plug-ins.
    Have a nice day and keep up the good work.

  3. Rhys says:

    @Udegbunam – Greetings to you, and thank you for asking about this.

    This script is DESIGNED to work for search queries, and it does, with the IE, Yahoo, and Live(Bing) search bars, in both IE and Firefox.

    When I test search for the LTK term “How to Get Listed Twice in the Top Ten SERPs” it works perfectly; I.E., Shows BizBlog » Blog Archive » How to Get Listed Twice in the Top Ten SERPs as No 1 on the SERP and when that result is clicked, the ad is displayed.

    The error here by Tedy is in the fundamental premise: “When I search in google using term “biznz.org”. It does not, and was designed not to work by typing URLs in the search bar

    The logic here is to detect focussed “search” traffic and to display relevant ads to it; but not to display ads to traffic arriving via URL: And I’m very happy that it does exactly that. The page Google lists as #1 in the SERP will be one most relevant to the Keyword being searched for; Adsense will display ads only relevant to that keyword term; the searcher will see ads pertaining only to the Key term (s)he searched for – Viola! – success.

    😀

  4. Thanks for amking the code so you can use it on any site. I have to see how this works and if it does make a difference.

  5. This sounds like a great way to only shows ads when you want. I wonder why google does not have setting that lets you choose to show ads like this. Thanks i will have to try the code you made it looks good to me.

  6. Polzic says:

    I ve made all you said, but my banner doesnt appear, i have to go to the blogger adsense wadget!

    CAn you give me a clue?

    My htm is in the

    http://galeon.com/polzic/adsense.htm

    and in that location it works!!!

  7. Rhys says:

    Can’t see any Hide Adsense code in the page code for site http://legosargentina.blogspot.com/.

    Where are you actually putting the code to display the HTML?

    😕

  8. Dave says:

    Thanks for sharing, I never thought social traffic is bad for adsense before 🙂

  9. psycholog says:

    I know it’s hard to find functional code for Blogger, so I’m happy to be of help.

    I endorse your point that we ought to “get backlinks that are strong“!

  10. This looks great although I’ve yet to implement it on my blog, I think it’s good considering it’ll annoy less people because Ads can take time sometimes to load pages so it’s good for everyone if you can hide it and show it only to certain audience so you get clicks as well.

    Thank you, I may try it out soon.

  11. Great info. Just want to share for blogger platform user, the scrpt can be parse to make available on blogspot. html parser can be found at http://www.blogcrowds.com/resources/parse_html.php
    .-= Ireland Money Online´s last blog ..Make money with paid online surveys =-.

  12. How can I cancel my google adsense account and start all over with different name but the same web site? It’s all because I’ve had this google adsense account for more than 2 years and the traffic to my website is quite good.
    .-= kissing bears baskets´s last blog ..celebrations with bears baskets =-.

  13. Hey Rhys,

    It feels good to see a lot of traffic in which social media’s traffic is also merged.

    But you cannot consider as a business point of view. traffic is good, but on minutely going through every detail the real clicks are almost half in my case.

    Using your programming that you’ve showed above I can get a clear picture about it.

    Thanks for posting it.

  14. Hi Rhys,
    You do have great info here.
    Thanks for the blogger code, I am sure this will be very helpful.
    Thanks for sharing!

  15. Oes Tsetnoc says:

    WTF! I’ve been looking and get nothing from other websites. A great find here. I hope I can improve my Adsense earnings with this tip. Keep it up sir!
    .-= Oes Tsetnoc´s last blog ..Google is Not Visiting This Site Anymore =-.

  16. This is great script! I made some modifications and now I only show ads to unregistered users of my forum 🙂
    .-= gry planszowe´s last blog ..Wiochmen Rejser =-.

  17. Wow!!Great thought on this post with have a nice info.IT is really nice sharing….

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

  19. Rhys says:

    I have looked at your page code, and there is no script showing in there. Blogger (G) will delete anything it doesn’t like. You need to pay particular attention to the Blogger install instructions or it will not work.

    😳 – Rhys

  20. sinusitis says:

    thank you for this interesting info. i was looking for something like this.
    i enjoy reading your blog
    .-= sinusitis´s last blog ..Tualergia.com: nueva tienda online para alérgicos =-.

  21. Build Website Traffic Knoxville Aug 12, 2009 Let’s take a quick look at how to generate Social Media Traffic . top search engine results is not the only way to drive more traffic to your website. It’s very important to be the first to write about the latest.

  22. Rhys says:

    @Kirra –

    I prefer to write about the techniques, keyword optimisation and design elements, for instance, that make a functional website.

    The writer you quote is recommending milking social traffic sites and then trying to convert the traffic to either buy or repeat. That is the kind of thing the ‘A-listers’ tell the suckers their followers to do.

    I hope to give my readers stuff they can use to build solid traffic; things that will give their sites real growth.

    😎 – Rhys

  23. ClubPenguinCheats says:

    Social sites like Stumbleupon can send you lots of traffic, but statistically it doesn’t ‘convert’ and you CTR can drop very …

  24. this is great technique, specially now a day there a lot of blogger who are earning from ad sense
    .-= sikatang pinoy´s last blog ..Pacquiao vs. Mayweather Hindi na Tuloy! =-.

  25. Thanks for sharing, I never thought social traffic is bad for adsense before
    i enjoy reading your blog

  26. Pinoy Hugs says:

    Nice idea! I will try this on my blog. I just realized that you can increase your adsense CTR if the visitor comes from a search engine. Thanks for the Tip!
    .-= Pinoy Hugs´s last blog ..Halalan 2010 sa Facebook (Pilipino Ako! Boboto sa Tamang Kandidato) =-.

  27. Pacquiao says:

    Now, I know how to increase my decreasing CTR. However, may I ask is this method is not violating Google Adsense TOS?
    .-= Pacquiao´s last blog ..Clottey Will Not Run Around on Pacquiao vs. Clottey Event =-.

  28. Rhys says:

    @Pacquiao

    This is why you should read the comments – this is answered at least twice above

    🙄 – Rhys

  29. TDAH says:

    I’ve been looking for a solution for that for a long time. Thank you for making the codes available to us.

  30. I just realized that you can increase your adsense CTR if the visitor comes from a search engine. Another thing, We use php on our blog to do just that, but the point of that particular script was to use a client-side script, rather than a server-side script because it is much easier for those ‘copy and paste’ users, and it works on Blogger, etc, where there are blocking codes that prevent server-side scripts working.
    .-= Mayweather-Mosley´s last blog ..‘Look Of Love’ – Mayweather and Mosley pair of gagsters =-.

  31. Is there a WordPress plugin which will do this for you rather than having to mess around with this code? This may be beyond a lot of people though I appreciate the reasons for doing it.

  32. wow nice code, I have learn more about the code in your site, keep it up, please give me more info about the ad sent.
    .-= littlelabster´s last blog ..Tips in Oriental rugs stay in long period of time =-.

  33. very Good share,böyle paylaşımların devamını bekliyoruz
    [Trans by Ed:We expect more of such shares] – 😉

  34. i lke it very much ,and you ?

  35. I had tried to implement your tip once earlier, but I wasn’t fully successful. I mean, the header banner was showing to SE traffic, but the rest of the ads weren’t working accordingly. I’ll try this again because I want to understand this properly.

  36. Steve says:

    The following link to the ‘Update on the Update’ has an Internal Server Error:

    http://weblog.biznz.net/2009/02/13/hide-adsense-from-social-traffic

    I’d like to get my hands on some even more brilliant solution from you.

    Thanks so much for the code so far!

    Regards

    S.

  37. Rhys says:

    Hi Steve –

    something ‘et’ the whole post – some evil competitor maybe??

    Anyhow, it is good now! – 😎 – Rhys

  38. Steve says:

    YES!! What a gem for sore eyes:)
    Thanks for the timely fix.

    I was thinking, wouldn’t this work (show ads) only on the first page? If we navigate further, the evaluated referer would not contain a search engine string anymore.

    I can’t test it right now but if I am right, maybe adding the site’s domain to the array would aleviate this (social traffic doesn’t usually navigate deeper).

  39. Web design says:

    This script work just fine thanks for information. bye

  40. cctv says:

    That’s a good and informative post.Thank you for the information …. and now my knowledge increases. Keep blogging.
    .-= cctv´s last blog ..Revolution in CCTV Equipment =-.

  41. Cool techique, we all know that social traffic and adsense don’t work. so why not hide the ads?

  42. Tjen Penger says:

    Yeah this is the kind of great info we like to find when searching for ways to improve our blogs.
    I wasn’t even aware of this issue with adsense and social media traffic. Thanks for the heads up!
    .-= Tjen Penger´s last blog ..Åhoi så mye penger du kan tjene! NOT!!! Hold dere unna GDI. =-.

  43. Kaiser says:

    Cool tutorials.Traffic from social media it not really targeted compared to Search Engine this will help a lot for your adsense account and for the advertiser
    .-= Kaiser´s last blog ..Free Text to Philippines Using Facebook ChikkaLite Application =-.

  44. Tioman says:

    The reason why to block ads is just logic.. I had doubt before why should I hide the ads, but to be honest, after reading this post, I would want to re-think again about hiding ads to social traffic. Thanks pal
    .-= Tioman´s last blog ..What is Tioman =-.

  45. Manny says:

    I use a different method from the one you show above – your method is much simpler, but I’m a bit worried about the IFrames and relevency of the ads. From your Blogger site, the ads look relevant, but I’d be interested in hearing your thoughts on this!
    .-= Manny´s last blog ..Pacquiao to Mayweather: I’ll Finish Him =-.

  46. Social Media traffic really sucks on adsense. The conversion rate and Cost per click is really low. Thanks for this tutorial on how to hide those ads. I will try it in my other sites.

    Thanks
    .-= NLE results July 2010´s last blog ..Top 10: Legendary Female Nurses =-.

  47. IraQlife says:

    The logic is simple – search traffic is motivated: therefore likely to click an ad – social traffic is just that, social, just looking to be entertained.
    Research shows that social traffic doesn’t click ads; and also that Adsense penalises you with smart pricing for low quality traffic.
    .-= IraQlife´s last blog ..ãäÊÏíÇÊ ÇáÑÓÊæãíÉ =-.

  48. Tipster says:

    Thank you for this blog. Thats all I can say. You most definitely have made this blog into something thats eye opening and important. You clearly know so much about the subject, youve covered so many bases. Great stuff from this part of the internet. Again, thank you for this blog.Thanks Tipster

  49. alergia says:

    I wonder if not showing ads on image search would increase earnings also. I do not think they click many ads so it would be interesting to see if you earn more not showing ads when someone finds site from image search.

  50. Rhys says:

    @Alergia

    Interesting question – does anyone have any experience to share??

    😎 – Rhys
    .-= Rhys´s last blog ..The Three Essential Internet Marketing Tools =-.

Leave a Reply

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