Parameter to Cookie – 12 Hour Expiry


if(!$_GET['utm_medium']){
if(!isset($_COOKIE["Lead_Source"])){
setcookie("Lead_Source", "Organic", time()+12*60*60);
}
}else if($_GET['utm_medium']=="ppc"){
if(!isset($_COOKIE["Lead_Source"])){
setcookie("Lead_Source", "Google Ads", time()+12*60*60);
}
}

The above was created to ascertain if a lead has come from a Paid Campaign.

This could also be refactored to check the referrer upon entry to the site. UTM was chosen as there was no need for variation in this case. ie. “Paid Lead or Organic Lead”.

Want a Fast Server Like Mine?

GET VULTR!