Configuring code triggers
Configuring code triggers does not require setting up custom parameters or adding Digital targeting re-evaluation functions to the chat client process. Although this technique does not take advantage of Digital's targeting, it provides ease of management and ensures the correct surveys are targeted.
With this technique, a user sees a specific survey when an agent ends the chat session. The chat client is configured so that buttons that end the chat execute JavaScript functions or set events. A Digital survey is configured with a code trigger.
To configure a code trigger to display a survey, complete the following steps:
At the beginning of a chat process, use the
KAMPYLE_ONSITE_SDK.loadForm(FormID)
API to preload the survey and ensure it is in a published state, where FormID is the ID of the survey. TheKAMPYLE_ONSITE_SDK.loadForm(FormID)
returns 'true' to indicate that the survey is available for display. The FormID can be inserted as a variable parameter so that it does not have to be hard-coded. The variable parameter could be updated using a Tag Manager.- Configure the chat client so that the button or control to end the chat does the following:
Checks the
loadForm
return code.Executes the
KAMPYLE_ONSITE_SDK.showForm(FormID)
function to display the survey.