I wanted to have better interaction with the PreChatWindow and wanted to pre-populate some of the fields when users where logged into my WebSite. Its anoying making the users enter there name and e-mail when I should already have it, so I made the following modifications to the PreChatSurvey.
1. Remove the AutoEventWireup="false" in the first line of the file.
2. Replace all the code from <!DOCTYPE - </HEAD> with the following
<script language="C#" runat="server">
void OutputVar(int num) { if ( Request.QueryString["SmartMax" + num] != null ) { Response.Write("if (typeof(theform.SmartMax" + num + ") == 'object') "); Response.Write("theform.SmartMax" + num + ".value = \""); Response.Write(Request.QueryString["SmartMax" + num]); Response.Write("\";"); } }
void FocusVar(string var) { Response.Write("if (typeof(theform." + var + ") == 'object') "); Response.Write("theform." + var + ".focus();"); } void Page_Load(object sender, EventArgs e){ Response.Write("<HTML>"); Response.Write("<HEAD>"); Response.Write("<script language=javascript>"); Response.Write(" function Populate() {"); Response.Write("var theform;"); Response.Write("if (window.navigator.appName.toLowerCase().indexOf(\"microsoft\") > -1) {"); Response.Write("theform = document.Form1;"); Response.Write("} else {"); Response.Write("theform = document.forms[\"Form1\"];"); Response.Write("}"); for (int i=1; i <= 10; i++) { OutputVar(i); } if ( Request.QueryString["autoSubmit"] != null ) Response.Write("document.getElementById(\"Image1\").click();");
if ( Request.QueryString["focus"] != null ) FocusVar( Request.QueryString["focus"]); Response.Write("}"); Response.Write("</script"); Response.Write(">"); }</script>
<title>Survey for chat.</title> <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"> <meta content="C#" name="CODE_LANGUAGE"> <meta content="JavaScript" name="vs_defaultClientScript"> <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </HEAD>
3. Add parameters to the calling URL like this:
PreChatSurvey.aspx?accountID=1&siteID=1&queueID=3&skipSurvey=no&SmartMax2=" & Session("activeLogin") & "&SmartMax4=" & Session("userEmail") & "&focus=SmartMax7
What this does is allow me to pass values on the URL to fill in the PreChatSurvey with, set which field in the survey has focus and then Autosubmit the survey if I wish, so users are entered directly into Chat mode.
One other thing to be carefull for is that the on-line and offline Surveys are different and I needed to add a Dummy Label to the off-line survey so the "Subject" field ended up being in the correct spot if the operator is offline and the focused item always works.
I realy think better control of the PreChatSurvey is needed as part of the base software, but until its added this works great and eliminates the need for my users to re-enter there information.
John
Eric Weber, President SmartMax Software, Inc.
I added your code (per your instructions) and modified the calling URL, but can't seem to get any data to pull in from the querystring.
We are using SightMax version 2.2 presently.
Here's the URL I'm trying to use (domain is modified for security):
https://www.example.com/SightMaxAgentInterface/PreChatSurvey.aspx?accountID=1&siteID=1&queueID=8&skipSurvey=no&SmartMax1=TestName&SmartMax2=123456&SmartMax3=123456&SmartMax4=123456&SmartMax5=123456&SmartMax6=123456
Assuming we can get that working, how do you make it auto-submit?
Thanks for any help you can provide!
I found that by adding 'onload="Populate()" to the BODY tag in the PreChatSurvey.aspx did the trick.
stcu:Assuming we can get that working, how do you make it auto-submit?
Looking at John's code, it looks like it's as simple as adding "&autoSubmit=true" to the URL
Hi,
I posted this question in the installation thread with no luck. This feature is currently not possible but if anyone have any creative way of doing this, I would really appreciate hearing about it.
For those of you that have a member database. Lets say that the member logs in. I store the member number in my Session["membernumber"] = "1122334455". Then they click on chat. Is there a way to pipe that information through so that number displays on the operator console. Then the operator would just look at that number and tell the user your order is on the way, you accout balance is 4400.00 without reauthenticating them like.. can I have your user number, can I verfiy your address/phone number, etc.
Now I looked at this solution. If I fill the Name filed with "Act Num: 1122334455" and auto sumit the pre-survey form, that field shows up nicely on the left side of the operator console but the process is not secure. Anyone can go to http://myserver/SightMaxAgentInterface/PreChatSurvey.aspxaccountID=1&siteID=1&queueID=2&SmartMax2=ActNum:88888888.
Now my operator would think that user 88888888 already logged in (which is not the case) and give the user all the info about 88888888 account.
Anyone has any workarounds for this? Some secure way of transfering this data would be very crucial feature for some users!
Thanks
I just installed 4.0 to start testing it, and was able to get this working by just copying the original code I had working in 3.0 to the 4.0 PreChatSurvey form. Everything works great. I can populate the Name and e-mail address and then the focus is on the next field waiting for input. Make sure you take out the "AutoEventWireUp=false otherwise the Page_Load event won't get wired up correctly.
I wish they would make this a standard feature in the API, its been around for a while now and if it was formalized feature it would be much easier for us.
I believe we now have a resolution to this issue that we an support as an official way to prepopulate the prechat survey. Visit this KB article for full details and code that you can add to your page.
http://support.sightmax.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=308
Regards,
Eric Weber