<?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>http_referer</title>
	<atom:link href="http://www.yackyack.co.uk/category/http_referer/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.yackyack.co.uk</link>
	<description>A Search Marketing Blog</description>
	<lastBuildDate>Fri, 20 Jan 2012 19:41:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>http_referer</title>
		<link>http://www.yackyack.co.uk/scripting/using-the-http-referer-to-personalise-your-pages/</link>
		<comments>http://www.yackyack.co.uk/scripting/using-the-http-referer-to-personalise-your-pages/#comments</comments>
		<pubDate>Wed, 21 Feb 2007 18:35:40 +0000</pubDate>
		<dc:creator>robwatts</dc:creator>
				<category><![CDATA[http_referer]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://www.yackyack.co.uk/2007/02/21/using-the-http-referer-to-personalise-your-pages/</guid>
		<description><![CDATA[Tweet Ever been to one of those pages that said &#8216;hi visitor from domain name and wondered how they knew where you&#8217;d came from? Well, for those of you who don&#8217;t (wonder that is) just um..go and read something else or make a cup of tea or something. For those of you who do, read <a href='http://www.yackyack.co.uk/scripting/using-the-http-referer-to-personalise-your-pages/'>[...]</a>


Related posts:<ol><li><a href='http://www.yackyack.co.uk/seo/using-search-engine-query-strings-to-optimise-your-content/' rel='bookmark' title='Permanent Link: Using search engine query strings to optimise your content.'>Using search engine query strings to optimise your content.</a></li>
<li><a href='http://www.yackyack.co.uk/google/does-the-google-algorithm-rank-pages-fairly/' rel='bookmark' title='Permanent Link: Does the Google Algorithm rank pages fairly?'>Does the Google Algorithm rank pages fairly?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="wp_twitter_button" style="float: right; margin-left: 10px;">
					<a href="http://twitter.com/share?counturl=http%3A%2F%2Fwww.yackyack.co.uk%2Fscripting%2Fusing-the-http-referer-to-personalise-your-pages%2F" class="twitter-share-button" data-url="http://www.yackyack.co.uk/scripting/using-the-http-referer-to-personalise-your-pages/" data-count="vertical" data-via="robwatts" data-lang="" data-text="">Tweet</a><br />
					<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
				</div>
<p>Ever been to one of those pages that said &#8216;hi visitor from domain name  and wondered how they knew where you&#8217;d came from?</p>
<p><em>Well, for those of you who don&#8217;t (wonder that is) just um..go and read something else or make a cup of tea or something. For those of you who do, read on&#8230;</em></p>
<p><span id="more-88"></span></p>
<p>It&#8217;s very simple really. Browsers record all manner(of things such as  useragent, operating system, screen width, resolution, time, date, IP address to name but a few. The aspect we are looking at is the <a href="http://www.faqts.com/knowledge_base/view.phtml/aid/31">HTTP_REFERER.</a></p>
<p>If you use a browser like internet explorer or firefox or opera then in most cases your browser will use this to record and provide the site that you used to arrive. So, when you click a link from site <strong>a</strong> to go to site <strong>b</strong>, site <strong>b</strong> could, if the right code was embedded, catch your referer info and give you a little message.</p>
<p>The following code is a simple example of how you use the HTTP referer to customise your user experience.</p>
<p>In this example we are going to imagine that we want to treat referals from say Yahoo or Google or MSN in slightly different ways. In this scenario, we&#8217;d be looking to reward each engine with say an output from their contextual advertising programs. The logic being that they gave us the traffic, so we are going to show their ads as a reward kinda thing.</p>
<p>If a visitor came from Y! then we&#8217;d output their ads, if they came from Google then we&#8217;d show theirs, from MSN theirs (if they had a program that is) and so on and so forth.</p>
<p>[php]</p>
<p><em>$refer = parse_url($_SERVER['HTTP_REFERER']);<br />
$domain= $refer['host'];//grab the host name<br />
$googleads=&#8221;code for goog ads&#8221;;<br />
$yahooads=&#8221;code for yahoo ads&#8221;;<br />
$msnads=&#8221;code for msn ads&#8221;;<br />
$standardads=&#8221;code for ads&#8221;;</em></p>
<p><em>if($domain){</em></p>
<p><em>if(strstr ($domain, &#8216;google&#8217;)){<br />
echo&#8221;$googleads&#8221;;</em></p>
<p><em>}<br />
if(strstr ($domain, &#8216;yahoo&#8217;)){<br />
echo&#8221;$yahooads&#8221;;</em></p>
<p><em>}<br />
if(strstr ($domain, &#8216;msn&#8217;)){<br />
echo&#8221;$msnads&#8221;;</em></p>
<p><em>}</em></p>
<p><em>}</em></p>
<p><em>else {<br />
echo&#8221;$standardads&#8221;;</em></p>
<p><em>}<br />
</em> [/php]</p>
<p>You could embed this code in a page or a theme or  template somewhere and provided that a valid http referer existed it would do what you asked of it.</p>
<p>You could use and adapt this in all sorts of ways by customising messages from say your best referers.If you were really into it you could go a step further and even parse the path or anchor info too even. The manual for the  <a href="http://uk.php.net/parse_url">parse_url</a> function provides detailed information and code examples on how this can be used.</p>
<script src="http://feeds.feedburner.com/~s/yackyack?i=http://www.yackyack.co.uk/scripting/using-the-http-referer-to-personalise-your-pages/" type="text/javascript" charset="utf-8"></script>

<p>Related posts:<ol><li><a href='http://www.yackyack.co.uk/seo/using-search-engine-query-strings-to-optimise-your-content/' rel='bookmark' title='Permanent Link: Using search engine query strings to optimise your content.'>Using search engine query strings to optimise your content.</a></li>
<li><a href='http://www.yackyack.co.uk/google/does-the-google-algorithm-rank-pages-fairly/' rel='bookmark' title='Permanent Link: Does the Google Algorithm rank pages fairly?'>Does the Google Algorithm rank pages fairly?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.yackyack.co.uk/scripting/using-the-http-referer-to-personalise-your-pages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  www.yackyack.co.uk/category/http_referer/feed/ ) in 0.59633 seconds, on Feb 9th, 2012 at 12:34 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 9th, 2012 at 1:34 am UTC -->
