Customize Guide Analytics Using APIs
You can track visitor behavior in Guide by using the NiCE CXone Legacy Dashboard and viewing Guide metrics.
Use the following APIs to define custom events, store visitor variables, store conversion data, assign and remove web tags, and more. Custom events that you send with Set Visitor Event are saved with your other Guide visit data. If you use Data Share, you can find them in the visit activity views.
Set Visitor Event
Stores the defined visitor behavior (event) for reporting purposes. Guide adds custom. to the start of the event name you send. When this call is used with Guide, 'event_type' is changed to 'custom_event_type'. Replace 'custom_event_data' with a data parameter of any type, including an object structure.
cxone('analytics','setVisitorEvent', 'event_type', 'custom_event_data');
Keep these rules in mind when you send a custom event:
-
Keep the event name to 23 characters or fewer. With custom. added, the full name can be up to 30 characters. If the name is longer, Guide does not save the event.
-
You can send text, a list (array), or an object as the event data. Text and lists are saved as { value: <your data> }. Objects are saved as you send them. If you send no data, Guide saves the event without data.
For example, this call records the page a visitor viewed:
cxone('analytics','setVisitorEvent', 'page_view', window.location.pathname);
In Data Share, each custom event appears in the visit activity view with the event name in CUSTOM_EVENT_ATTRIBUTE_NAME and the event data in CUSTOM_EVENT_ATTRIBUTE_VALUE. For column details, see the Data Share library.
Set Visitor Variable
Stores the defined visitor information for reporting purposes.
cxone('analytics','setVisitorVariable', 'variable_identifier', 'variable_value');
Store Conversion
Stores the visitor behavior as a conversion for reporting purposes. If the conversion_date parameter is omitted, the current date and time is used for the conversion.
cxone('analytics','storeConversion', 'conversion_type', conversion_value, conversion_date);
Set these as follows:
-
Replace 'conversion_type' with a value such as USD.
-
Replace conversion_value with a numeric value to use in Guide reports to track the effectiveness of engagements.
-
Replace conversion_date with a JavaScript date object. If omitted, new Date() is used.
Assign Web Visitor Tag
Adds specified tags to a visitor. In the following syntax example, replace tagID with a visitor tag.
cxone('analytics','addVisitorTags', tagID);
Remove Web Visitor Tag
Removes specific tags from a visitor. In the following syntax example, replace tagID with a visitor tag.
cxone('analytics','removeVisitorTags', [tagID, tagID]);
Clear Visit Data
Removes information about the current visit. The visit is the browsing session. If user reloads a page, Guide considers it a new visit.
cxone('analytics','clearVisit');
Set Country
Allows setting custom country value. Input is a string. Replace 'Country' with a browser country code.
cxone('analytics','setDeviceCountry','Country');
Set Location
Allows setting custom location value. Input is a string. Replace 'Location' with a browser location code.
cxone('analytics','setDeviceLocation','Location');
Turn Off SPA Detection
Turns off automated single page application detection.
cxone('analytics', 'setSPADetection', false);
Page Loaded
Allows Guide to recognize that a page has been refreshed. This is used when single page application detection is off. Input is a string. Replace 'page-url' with the page URL or replace 'page-title' with the page title.
cxone('analytics', 'sendPageView', {url: 'page-url'});cxone('analytics', 'sendPageView', {title: 'page-title'});
Disable Web Tracking
Disables the web tracking module.
cxone('disableModule', 'analytics');