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. What is clickable when it comes to adsense? A text link or Image?
    .-= engrape of blogger´s last blog ..Engrape Financier – An Entry =-.

  2. Philippines says:

    Goodness gracious.. That’s seems like a lot of work to do… But I got to try this. This should help my blog earn more money.. =)
    .-= Philippines´s last blog ..Lourdes Grotto, Dapitan, Philippines =-.

  3. I am going to try this script in my blog. It’s new for me. But ok.

  4. 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.

  5. storkclub says:

    neat trick, Rhys, you really know your stuff.I hope this can help me promote my webstie.

  6. This is amazing I kindly apply to my site its works.
    watch pacquiao vs margarito´s last blog post ..Where is the venue Pacquio vs Margarito

  7. Thanks a lot Rhys. I’ve been looking to improve my CTR on AdSense for the past few weeks. I’ll try this now 🙂

  8. Btw Rhys, i have to say it’s a pretty neat tactic. I actually recently realized that most of the social Traffic doesn’t bring any ad revenue at all. I hope this will be my CTR solution 🙂
    Hosting | John Alden´s last blog post ..Response cached until Thu 12 @ 14:25 GMT (Refreshes in 23.68 Hours)

  9. Sandra says:

    I just went over to your teaching page. This is going to help me out alot. I plan on making more sites and I hate to have to go back to all of them and do this to them.

  10. egipt says:

    Thanks – this is very good code. Works perfectly 🙂 Now I need only some php code to rotate my Adsense adds 🙂

  11. Alergias says:

    Social traffic sucks and most of my sites don’t get it, but its still a nice chunk of code to add when you need it.
    Alergias´s last blog post ..Lo que esconde la rinitis alérgica- 10 consecuencias de cuidado

  12. Most of my traffic came from social media sites like FB and I think this code tweak can really help me a lot to increase my earning. Thank you for this.
    Pacquiao vs Margarito´s last blog post ..Pacquiao Now in Baguio City for Intensive Training

  13. I’ve learned a lot of useful thing from this post. Thanks a lot for sharing such an incredible post with us. Keep blogging.

    NJ carpet cleaning
    NJ carpet cleaning´s last blog post ..Service Areas

  14. seo experts says:

    I found something interesting and I think it would be a great share here. There is a tips that I found it here to show adsense using javascript to search engine traffic which have a good CTR, and hide them from social media traffic.

  15. I would like to know what the best way to hide or spoof my traffic source would be. I don’t want my affiliate managers seeing my traffic and possibly stealing my campaign. Maybe I’m paranoid but It’s earning me some good income right now and I don’t want this ruined…
    pay day loans uk´s last blog post ..Alternatives to Pay Day Loans – Don’t Just Get In Debt!

  16. This is very good script. I changed it a little and add some different functions like showing different ads type depending of the referer 😉 Thanks!

  17. 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.

  18. Rob Poulos says:

    I found something interesting and I think it would be a great share here. Social traffic sucks and most of my sites don’t get it, but its still a nice chunk of code to add when you need it.
    Rob Poulos´s last blog post ..Rob Poulos Fitness Program Worth It

  19. Usefull article do you mind if i translate into Spanish for my sites visitors? If thats acceptable what type of acknowledgement do you require?

  20. Rhys says:

    Hi Quinn –

    You are welcome to translate this, so long as you add a link credit in the style of “Translated from BizBlog – Thank you – Rhys

    😎

  21. J says:

    Happy New Year Rhys.

    Been what, almost 2 years since I posted here. Haven’t been banned yet 🙂 Had to google it cause I forgot how to do it.

    My $8/day is now 80+ and I’m more paranoid than ever lmao

  22. Rhys says:

    Hey J!

    You are very welcome, glad you could still find us – seems all that SEO stuff actually works!!!

    😎 – Rhys

  23. J says:

    haha yeah, but I think 80/day after 2 years is considered bad by the IM gurus. I’m just happy (and paranoid) that I got to the 4 digit/month range!

  24. enigin says:

    These are highly informative and helpful.Thanks for giving us such quality knowledge.Waiting for your next interesting posts.
    enigin´s last blog post ..Enigin’s London Training Course

  25. Marble Games says:

    I use same computer for open adsense account and IP Hide software for create some backlinks. Thanks for the plug! You have written a very clear explanation of Smart Pricing.

  26. This is new for me. I am going to try this script in my blog. I want to more details about this…

  27. neon lights says:

    This is a good idea. I think this code tweak can really help me a lot to increase my earning. I appreciate way of working…

  28. tie shop says:

    I use same computer for open adsense account and IP Hide software for create some backlinks. Great coding here, it is not common to find a blog with some decent information in it.

  29. I use same computer for open adsense account and IP Hide software for create some backlinks. Thanks for the plug!

  30. p90x says:

    I just want to say that I know PHP better. I was not aware that I can just do this with the help of your code. Thanks for sharing this.

  31. Ricky says:

    I cant hide the adsense on my blog using the code that you gave..:(

  32. Ashvini says:

    I am sorry if this is already discussed.
    I think that the code where you echo adsense is too complicated. Instead, in your php file use this


    …….

    That’s it
    No need to echo all those complicated ad code
    Ashvini´s last blog post ..Facebook Vs Google – Its a war out there

  33. Hello I sincerely cherish your write-up. In the event that you would prefer to chitchat pertaining to it,Iwould like to discuss together with you, my name is Frank. My personal electronic mail is above. Cheers!

  34. Great tip. Most people never bother making code for blogger they always make it for wordpress. I wonder if not showing ads on image search would increase earnings also.

  35. is this applicable this days?
    Watch Swipertv´s last blog post ..Nikita Season 2 Episode 5: Looking Glass

  36. Rhys says:

    @WatchTV

    As far as I know, Yes

    😉 – Rhys

  37. Roseline Lainhart says:

    Thanks for the codes above, I’m searching and I found your blog interesting. This is exactly what I need on how to hide adsense from social traffic.

    Many thanks!
    Roseline
    Roseline Lainhart´s last blog post ..Black Mold Removal

  38. Mr.Russian says:

    Regarding adsense, people should know whats happening! I am finding that if someone is using Google adsense (say for some months no problem and money increases double month over month) and then they sign up with advertising on Bing – even though Unique visits continues to climb, the adsense clicks suddenly drop by more then 60%!!! Nothing anyone can do I’m sure, which is why and how Google can do this crap, but I wanted to at least let people know what is happening. Its more then scammy its fraudulent! At least one website this is happening too is http://www.BridgeToRussian.com -FYI

  39. hcg test says:

    My brother suggested I might like this web site. He was entirely right.
    This post actually made my day. You can not imagine simply how much time I had spent for this info!
    Thanks!
    hcg test´s last blog post ..hcg test

Leave a Reply