I’m not experienced enough to take all the logic that you’ve laid out, and apply it to my example. In theory, I understand that:
1. I need to set up a url that has the variable I’m trying to capture
2. I need some way to attach those variables to a user’s profile
Now for my specific situation, I’ve found a script that takes the utmz cookie in google analytics, and parses out all the different variables (like referring domain, keyword, medium, source) , listed here:
<?php
//DEFINE COOKIE DOMAIN, ALLOWS SCRIPT TO BE USED ACROSS MULTIPLE DOMAINS
$domain = $_SERVER['SERVER_NAME'];
$domain = "." . ltrim($domain,"www.");
// SET COOKIES FROM GOOLGE-ANALYTICS COOKIE
$info = $_COOKIE['__utmz'];
// Get rid of id stuff
$holder = split("u", $info, 2);
$string = "u" . $holder[1];
// Parse String
$ga_vars = split("\|", $string);
foreach ($ga_vars as $var) {
list($key,$value) = split("=",$var);
if ($key == "utmcmd") { setcookie("Medium", $value, time()+100000000, "/", $domain); $medium = $value; }
if ($key == "utmctr") { setcookie("Keywords", $value, time()+100000000, "/", $domain); $keywords = $value; }
if ($key == "utmcsr") { setcookie("GAsource", $value, time()+100000000, "/", $domain); $gasource = $value; }
}
// SET REFERRING URL
if (!isset($_COOKIE['Referer'])) {
setcookie("Referer", $_SERVER['HTTP_REFERER'], time()+10000000, "/", $domain);
$referurl = $_SERVER['HTTP_REFERER'];
} else { $referurl = $_COOKIE['Referer']; }
// SET FORM_URL VALUE
$formurl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
// SET LANDING PAGE
if (!isset($_COOKIE['LandingPage'])) {
setcookie("LandingPage", "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], time()+10000000, "/", $domain);
$landingpage = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
} else { $landingpage = $_COOKIE['LandingPage']; }
?>
So I imagine that there is some way for me to somehow grab the variables from the code above, and display them in my user list in the admin dashboard as another column of information. But I have no idea how that would work.