The Embedded Code - Recording Contact Information

You can use the embedded code to record visitor contact information. The contact information is recorded against the visitor in the WhosOn database and will show against the visitor on subsequent visits.

 

The following fields can be specified:

 

var sWOName="";

var sWOCompany="";

var sWOEmail="";

var sWOTelephone="";

 

These are all optional.

 

Example uses:

 

Suppose you have a 'request information' form on your web site, where your visitors can fill in a form with their details. This form calls an ASP or PHP page that sends you an email or adds a record to a database. You could embed a version of the WhosOn tracking code on this script page so that the visitors contact info also gets added to WhosOn.

 

For example, the following ASP page is called after a user fills in a form. The form variables are retrieved via ASP. Then some ASP code writes the javascript lines for the WhosOn tracking code contact variables. The contact variable definitions are removed from the main WhosOn tracking code block since they are already being defined in the ASP block.

 

When the page executes, the form values are extracted via ASP. The WhosOn tracking code executes and the name, company, email and telephone values are sent to WhosOn.

 

<html>

<body>

<p><b>WhosOn Test Page - Submitted</b></p>

<p>This test page shows how we can receive a form submit and post visitors contact information back to WhosOn. This contact info will be recorded in the WhosOn database and show against the visitor.</p>

<%@LANGUAGE="VBScript" %>

<%

    On Error Resume Next

    Dim Email,Name,Company,Telephone

 

    ' extract form variables

    Email     = Request("Email")

    Name      = Request("Name")

    Company   = Request("Company")

    Telephone = Request("Telephone")

 

    ' process your form

 

    ' write the Whoson tracking code variables

    Response.Write "<script language='javascript'>"

    Response.Write "var sWOName      = '" & Name & "';"

    Response.Write "var sWOCompany   = '" & Company & "';"

    Response.Write "var sWOEmail     = '" & Email & "';"

    Response.Write "var sWOTelephone = '" & Telephone & "';"

    Response.Write "</script>"

%>

 

<script language="javascript">

var sWOGateway       = "mygateway.com"; // specify the address of the WhosOn Gateway server

var sWODomain        = "www.mysite.com"; // the domain you are monitoring

var sWODepartment    = ""; // optional department

var sWOChatstart     = "http://yoursite.com/chat/chatstart.htm"; // url to the chatstart.htm page

var sWOLanguage      = "en"; // language for the chat window

var sWOBackgroundURL = ""; // optional custom background url

var sWOResponse      = "Y"; // set to a blank string if you do not want a visible chat link

var sWOInvite        = "Y";  // set to a blank string if you do not want invite requests to be polled

 

var sWOSession;

var sWOUrl;

var sWOUser="";

var sWOPage="";

var sWOProtocol=window.location.protocol;

 

var sWOCost=0;    // specify a visit cost

var sWORevenue=0; // specify the revenue generated by the visitor

 

if(sWOUser==""){

// create a unique session cookie for the visitor

var dt=new Date();

var sWOCookie=document.cookie.toString();

if(sWOCookie.indexOf("whoson")==-1){

sWOSession=parseInt(Math.random()*1000)+"-"+dt.getTime();

document.cookie="whoson="+sWOSession+";expires=Fri, 31-Dec-2010 00:00:00 GMT;";

}

sWOCookie=document.cookie.toString();

if(sWOCookie.indexOf('whoson')==-1){

sWOSession="";

} else {

var s=sWOCookie.indexOf("whoson=")+7;

var e=sWOCookie.indexOf(";",s);

if(e==-1)e=sWOCookie.length;

sWOSession=sWOCookie.substring(s,e);

}

}

 

if(sWOUser!="")sWOSession=sWOUser;

if(sWOPage=="")sWOPage=escape(window.location);

if(sWOProtocol=="file:")sWOProtocol="http:";

 

sWOUrl=sWOProtocol+"//"+sWOGateway+"/stat.gif?u="+sWOSession+"&d="+sWODomain;

if(sWODepartment.length>0)sWOUrl+="&t="+sWODepartment;

sWOUrl+="&p='"+sWOPage+"'&r='"+escape(document.referrer)+"'";

 

if(sWOCost!=0)sWOUrl+="&c="+sWOCost;

if(sWORevenue!=0)sWOUrl+="&v="+sWORevenue;

if(sWOName!="" || sWOCompany!="" || sWOEmail!="" || sWOTelephone!="")sWOUrl+="&n="+sWOName+"|"+sWOCompany+"|"+sWOEmail+"|"+sWOTelephone;

 

if(sWOResponse==""){

if(document.layers)document.write("<layer name=\"WhosOn\" visibility=hide><img src=\""+sWOUrl+"\" height=1 width=1><\/layer>");

else document.write("<div id=\"WhosOn\" STYLE=\"position:absolute;visibility:hidden;\"><img src=\""+sWOUrl+"\" height=1 width=1><\/div>");

} else {

sWOUrl+="&response=g";sWOChatstart+="?domain="+sWODomain+"&lang="+sWOLanguage;

if(sWOBackgroundURL!="")sWOChatstart+="&bg="+sWOBackgroundURL;

if(sWODepartment.length>0)sWOChatstart+="&department="+sWODepartment;

document.write("<a target=\"_blank\" href=\""+sWOChatstart+"\" onclick=\"javascript:window.open('"+sWOChatstart+"','new_win','width=484,height=361');return false;\"><img border=\"0\" src=\""+sWOUrl+"\"><\/a>");

}

sWOUrl=sWOProtocol+"//"+sWOGateway+"/invite.js?domain="+sWODomain;

if(sWOInvite=="Y")document.write("<scr"+"ipt language='Javascript' src='"+sWOUrl+"'><\/sc"+"ript>");

</script>

</body>

</html>