Integrate CXone Expert Analytics With a Support Ticketing Form
- Applies to:
- MindTouch (current)
- Role required:
- Admin
CXone Expert Analytics can keep track of how many users visit your ticket submission form and then go on to submit a ticket. Once this code is installed on your ticketing form, you can see how many of your users are self-serving on your site. These metrics can be viewed in the Self-Service Report.
Current implementation only supported on forms that are hosted in Expert sites. Future implementation options are currently under development.
Prerequisites
- Access to edit the ticket submission form
- Basic understanding of HTML code
How to set up analytic tracking on a site
Adding analytic tracking to an existing ticket submission form hosted on an Expert site requires JavaScript added to the page and may require a minor update to the form submit element.
- Edit the page that contains the ticket submission form
- In the submission form code, locate the code that handles the case submission (Example:
<input>"Submit Case"</>
) - Add a
name
attribute with the valuesubmit
to the submission (Example:<input name="submit">"Submit Case"</>
)- If there is already a
name
attribute associated with the submission, note the value to be used on step 6
- If there is already a
- Create a new Javascript block below the submission form with the following code
document.addEventListener('mindtouch-web:analytics:form-activity-logger-ready', function(ev) { var logger = ev.data.logger; var button = document.querySelector('input[name="submit"]'); button.addEventListener('click', function() { logger.submit(); }); }); document.addEventListener('mindtouch-web:loaded', function(ev) { var analytics = ev.data.analytics; analytics.initFormActivityLogger('case'); });
- If in step 2 the submission is not using an
<input>
and is instead using a<button>
, replaceinput
withbutton
on line 3 of the Javascript
Example:var button = document.querySelector('button[name="submit"]');
- If in step 3 there was already a name attribute associated with the submission, replace the name on line 3 of the Javascript to match this name
Example:var button = document.querySelector('input[name="[new_name]"]');
- Save the page
Events will start appearing in the Self-Service report the following day due to nightly data processing.