I have these marketing campaigns running (like google adwords) and based on where a user comes from (google, yahoo, mns-bing, facebook) I have this referrer code passed that I collect out of the URL and I put a cookie on the user’s computer based on what is included in this tag. OK so now I have to get the the cookie (which I know how to do) and based on if this cookie says website I need to show a drop down with sources for the user to choose from. That is my delimna. I typically code in PHP but this site wasn’t developed by me so this cookie tracking was done in javascript. My issue is normally in PHP I can say if(referrer==website) then close off the php code and then go into the HTML but that doesn’t seem to work for javascript. Can someone help me with this please?
What I"m doing is retrieving the cooking and now all I want to do is say if the cookie is website show this drop down menu. The code that is currently on the site is attached.
<script>
function getCookie(c_name)
{
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1)
{
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
document.inquiry.referer.value = unescape(document.cookie.substring(c_start,c_end));
return false;
}
}
document.inquiry.referer.value = 'Website';
}
jQuery(document).ready(function() {
getCookie('referer');
});
</script>
The drop down I want to show is:
<select name=How_did_you_find_us>
<option value=''>Please Select</option>
<option value=Billboard>Billboard</option>
<option value=Direct Mail>Direct Mail</option>
<option value=Facebook>Facebook</option>
<option value=High School Presentation>High School Presentation</option>
<option value=Internet/Search Engine>Internet Search</option>
<option value="Magazine">Magazine</option>
<option value="MySpace">MySpace.com</option>
<option value="Newspaper">Newspaper</option>
<option value="Poster">Poster</option>
<option value="Radio">Radio</option>
<option value="Referral">Referral</option>
<option value="TV">TV</option>
<option value="Yellow Pages">Yellow Pages</option>