I have two types of users on my site, and need to track them under separate Google accounts. I am using the JS code below to pick the tracking code to use. Alerting the variable "trackCode" on the final page shows it as UA-xxxxxxx-3, but all transactions come into Analytics as UA-xxxxxxx-1. Anyone doing anything like this?
<script type="text/javascript">
function getCookie(Name){
var re=new RegExp(Name+"=[^;]+", "i");
if (document.cookie.match(re)) {
return document.cookie.match(re)[0].split("=")[1];
} else {
return "";
}
}
try {
var custLevel = getCookie("SFCustomerLevel");
var trackCode = "";
switch (custLevel) {
case "D2":
case "D1": trackCode = "UA-xxxxxxx-3";
break;
default: trackCode = "UA-xxxxxxx-1";
break;
}
var pageTracker = _gat._getTracker(trackCode);
pageTracker._trackPageview();
} catch (err) {
}
</script>