<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OHeHLium liang~ &#187; adsense</title>
	<atom:link href="http://www.ohehlium.com/log/category/adsense/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ohehlium.com/log</link>
	<description>Say something~</description>
	<lastBuildDate>Wed, 11 Nov 2009 15:37:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Show Google Adsense only to searchers</title>
		<link>http://www.ohehlium.com/log/2006/11/09/show-google-adsense-only-to-searchers/</link>
		<comments>http://www.ohehlium.com/log/2006/11/09/show-google-adsense-only-to-searchers/#comments</comments>
		<pubDate>Fri, 10 Nov 2006 02:20:59 +0000</pubDate>
		<dc:creator>liang</dc:creator>
				<category><![CDATA[adsense]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.ohehlium.com/log/2006/11/09/show-google-adsense-only-to-searchers/</guid>
		<description><![CDATA[I am not sure whether this is a good idea or not, but I like it and figured out a way doing it by using session.

First, get to know who is from search engines by checking the referers. There are so many search engines to list that I don't want to match their names into [...]]]></description>
			<content:encoded><![CDATA[<p>I am not sure whether this is a good idea or not, but I like it and figured out a way doing it by using session.</p>
<ul>
<li>First, get to know who is from search engines by checking the referers. There are so many search engines to list that I don't want to match their names into the referers' url. Instead, I thought "?" exists in all these query-like engine search urls. But I saw some "?" is inside some url from msn/live spaces as well. So I switched to check whether "&#038;" is inside or not.</li>
</ul>
<div class="igBar"><span id="lcode-4"><a href="#" onclick="javascript:showPlainTxt('code-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-4">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#40;</span>strpos<span style="color:#006600; font-weight:bold;">&#40;</span>$_SERVER<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">"HTTP_REFERER"</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#CC0000;">'&amp;'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">&#40;</span>Your Google Adsense Content<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<ul>
<li>Second, keep the information that the visitor is coming from searching if the visitor finds some other interesting posts within the site and go around, so google ads can be continuously displaced. Since the varible, which keeps the information, needs to go through pages, then it is best to be stored in session. So I do the following</li>
</ul>
<div class="igBar"><span id="lcode-5"><a href="#" onclick="javascript:showPlainTxt('code-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-5">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#40;</span> strpos<span style="color:#006600; font-weight:bold;">&#40;</span>$_SERVER<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">"HTTP_REFERER"</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#CC0000;">'&amp;'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$_SESSION<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'ad'</span><span style="color:#006600; font-weight:bold;">&#93;</span>=true;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> ?&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#40;</span>$_SESSION<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'ad'</span><span style="color:#006600; font-weight:bold;">&#93;</span>==true<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">&#40;</span>Your Google Adsense Content<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<ul>
<li>Third, how about then someone is willing to see the ads and they are not from search engines (who will be that? me, at least, at my own site :p ). So just put another tricky mark in the url to pass the variable to $_GET and then keep the option remembered by session. You may notice from the code, using "?ad=" at the end of url will let you just have google ads once by "?ad=(anything except y)" or for the whole session by "?ad=y"</li>
</ul>
<div class="igBar"><span id="lcode-6"><a href="#" onclick="javascript:showPlainTxt('code-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-6">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#40;</span> strpos<span style="color:#006600; font-weight:bold;">&#40;</span>$_SERVER<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">"HTTP_REFERER"</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#CC0000;">'&amp;'</span><span style="color:#006600; font-weight:bold;">&#41;</span> || <span style="color:#006600; font-weight:bold;">&#40;</span>$_GET<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'ad'</span><span style="color:#006600; font-weight:bold;">&#93;</span>==<span style="color:#CC0000;">'y'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$_SESSION<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'ad'</span><span style="color:#006600; font-weight:bold;">&#93;</span>=true;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> ?&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>$_SESSION<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'ad'</span><span style="color:#006600; font-weight:bold;">&#93;</span>==true<span style="color:#006600; font-weight:bold;">&#41;</span> || !empty<span style="color:#006600; font-weight:bold;">&#40;</span>$_GET<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'ad'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">&#40;</span>Your Google Adsense Content<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
I didn't use this method here for this blog, but you do can test it at this <a title="ohehlium journal" href="http://www.ohehlium.com/journal">journal blog</a> here:</p>
<p>Directly use this link:   <a href="http://www.ohehlium.com/journal/2006/10/01/140/">http://www.ohehlium.com/journal/2006/10/01/140/</a>  (no adsense)</p>
<p>Then try google first, and see:  <a title="ohehlium nobel" href="http://www.google.com/search?q=nobel+site:ohehlium.com&#038;hl=en&#038;lr=&#038;filter=0">Nobel site:ohehlium.com</a>, click this <a title="googled" href="http://www.google.com/url?sa=t&#038;ct=res&#038;cd=4&#038;url=http%3A%2F%2Fwww.ohehlium.com%2Fjournal%2F2006%2F10%2F01%2F140%2F&#038;ei=X95TRdSTNamWaLG28bsG&#038;usg=__GEwUzazIDOJp5xJ4nnMxuIaIgHk=&#038;sig2=vOpfJGwxHFB77zHlidLYwg">link</a> and go, you will have ads there and you will have it when visiting around unless you close the browser</p>
<p>Or try this link:  <a title="ad option" href="http://www.ohehlium.com/journal/2006/10/01/140/?ad=1">http://www.ohehlium.com/journal/2006/10/01/140/?ad=1</a>, you will have one time adsense</p>
<p>Or then this one:  <a title="ad option" href="http://www.ohehlium.com/journal/2006/10/01/140/?ad=y">http://www.ohehlium.com/journal/2006/10/01/140/?ad=y</a>, then the same thing as from search engines<a title="ad option" href="http://www.ohehlium.com/journal/2006/10/01/140/?ad=y"><br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ohehlium.com/log/2006/11/09/show-google-adsense-only-to-searchers/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
