title: Set referer on first visit to site
body: <p>I have a site where the phone number in the header file needs to change depending on the referrer. If someone comes to the site via google, for example, the phone number is different that if they came directly to the site.
  I have it working, except for when the user goes to a different page on the site. The code checks the referrer and changes the number to the direct number.
  What I want is for the number to be set by the referrer the first time the user visits the site, and for it not to change. I imagine cookies or sessions are the way to go here, I"m just not sure how the code should be structured. </p>
  
  <pre><code>if (!empty($_SERVER['HTTP_REFERER'])) //user has come via search engine or a page within our site
  {
  $referer = $_SERVER['HTTP_REFERER'];
  if (strpos($referer,'google') !== false) {
  $callin_number='1-444-444-4444';
  $callin_dialer=preg_replace("/[^0-9,.]/", "", $callin_number);
  }   
  elseif (strpos($referer,'bing') !== false) {
  $callin_number='1-111-111-1111';
  $callin_dialer=preg_replace("/[^0-9,.]/", "", $callin_number);
  }
  else {
  $callin_number='1-222-222-2222';
  $callin_dialer=preg_replace("/[^0-9,.]/", "", $callin_number);
  }
  }
  
  else { //user has come directly to site
  $callin_number='1-333-333-3333';
  $callin_dialer=preg_replace("/[^0-9,.]/", "", $callin_number);
  }
  </code></pre>