I'm trying to push some custom data to the chat console from pre chat from but without success. I've tried hidden form elements like this:
<input type="hidden" name="liveagent.prechat:Username" value="Anonymous" />
And also tried JavaScript API
liveagent.addCustomDetail('Username', "Anonymous", true);
But the agent sees only most recently viewed pages when hovering over "Accept" chat button. Also no custom variables are displayed after chat is initialized.
The pre-chat form is embedded on a client site. To submit the form I just use this code:
<a href="javascript://Chat" onClick="liveagent.startChat('XXXX')">START CHAT</a>
How can I debug this? What is the correct way to pass this custom data?
Best Answer
You are using the deployment API which is different to the tags that must be used in the pre-chat form.
Here is an example on how to create a case with some information pre-populated that will also show in the console for the agent, you can do the same without creating a record, this should give you an idea.
The section you care about if all you want is to show the details on the console would be this
in combination with this value
With that, you are assigning a value to a custom chat detail that will be shown to the agent that gets the chat assigned.