Just today, I decided to run an impromptu experiment to test if visitors who come from search engines are really more likely to click on ads. It’s considered “common knowledge” by many bloggers who advise everyone to only show ads to search engine visitors (as a quick Google search will illustrate), but my own AdSense stats made me doubt that particular piece of advice. Hence the experiment.

So how does one show different ads to different visitors? Normally you could use the excellent Who Sees Ads plugin, but that doesn’t work for my site. I’m using the WP-SuperCache caching plugin which is incompatible with Who Sees Ads.

Instead, I wrote a JavaScript function that can analyse the HTTP referrer to distinguish between four types of visitors :

People who accessed your page directly, e.g. by typing in the URL (no referrer).

People who clicked an internal link to access the page (referrer from the same domain).

Search engine visitors; people who arrived via Google or Yahoo! (referrer matches one of the most popular search engines).

External visitors. This is basically a catch-all category for everyone who found your link on a third-party site that’s not a search engine. For example, this would include external forums and web directories.

Unlike get_referrer_type(), this script is optimized for my site/AdSense account. Don’t try using it without modification 😉 If you want to use it, replace “pub-XXXXXXXX”, the ad slot IDs and ad width/height settings with your own values (you can find them in your AdSense ad code).

5 Responses to “Showing Different Ads To Different Visitors”

My site is one of those listed in the Google search (and many of the others ones are republishing my code), so I have an interest in your experiment.

One of my friends recently experimented with this and found that he made more by serving ads to everyone. However, that was only the case when the percentage of traffic from search engines was 80% or more. 6 months earlier, when only 50% of visitors were from search, he ran into the smart pricing problem and made less money.

Or of course it could be Google has changed the way they calculates things. Know one really knows with Google. Looking forward to your results!

This site gets ~70% of its traffic from search engines, so it might be somewhere in between. I’ll keep the script running for a week or so, which should let me accumulate a reasonable amount of data to draw conclusions from.

This is the code i am searching for this , i found many codes in search result but none of them works with else conditions, you made it to the next level with multiple variables of ref .
This code will help many people in web,

Search

This site uses cookies to improve your experience, to personalize ads and to analyze traffic. It also shares information about your use of this site with social media, advertising and analytics partners. By using this site, you agree to its use of cookies. AcceptSee Details