// Sets the client cookie with the name/value pair provided.
function setCookie(cookieName, cookieValue, cookiePath, cookieExpires)
{
cookieValue = escape(cookieValue);
if (cookieExpires == '')
{
var nowDate = new Date();
nowDate.setMonth(nowDate.getYear() + 5);// Expire the cookie in 5 years.
cookieExpires = nowDate.toGMTString();
}
if (cookiePath != '')
{
cookiePath = ';Path=' + cookiePath;
}
document.cookie = cookieName + '=' + cookieValue +
';expires=' + cookieExpires + cookiePath;
}
// Function: initialTraffic
// Creates an image object to send a request to the traffic server w/ browser support infomormation included.
function initialTraffic(uuid, release, trafficSite)
{
// Configuration variables.
//var trafficSite = '//localhost/SEMTrafficCollector';
//var version = 1;
//var account = '{69ece8bf-5ad2-43a3-904c-0693c82fb8cb}';
var nhp = 'http:';
// Local variables.
var query,rf,sr,request,i;
rf=document.referrer;
sr=document.location.search;
if(top.document.location==document.referrer || (document.referrer == '' && top.document.location != ''))
{
rf=top.document.referrer;sr=top.document.location.search
}
if(location.href.substr(0,6).toLowerCase()=='https:')
nhp='https:';
query='uuid='+uuid+
'&release='+release+
'&cookie='+document.cookie.length+
'&browser='+escape(navigator.appName)+
'&version='+escape(navigator.appVersion)+
'&platform='+escape(navigator.platform)+
'&referer='+escape(rf);
if(navigator.appVersion.substring(0,1)>'3')
{
query=query + '&colors='+
screen.colorDepth+'&screen='+escape(screen.width+ ' x '+screen.height)+
'&java='+ navigator.javaEnabled()
}
//alert(top.document.referrer);
//alert(document.referrer);
// Create a trafic url with the appropriate site and query string information.
request = nhp+trafficSite+'/image.tfc?'+query;
// Debug statement.
//alert(request);
//document.write(request);
// Create an image object an set the source to be the custom url.
i = new Image();
i.src = request;
}
// Creates a unique identifier using the current time and a random number.
var trafficSite = '//www.websourcedtraffic.com';
var release = '2';
uuid = 'e10692fc-fa7e-4b69-b972-eaf71712dfb7';
var cookieName = 'uuid.websourcedtraffic.com';
// Create an initial traffic request.
initialTraffic(uuid, release, trafficSite);
setCookie(cookieName, uuid, "", "");