How to create Custom events for User Experience Analytics?

Alina-Maria_S
Tera Expert

Hello,

Does anyone know where to find more information on how to create custom events for User Experience Analytics? For example how many users have accessed Raise and Incident record producer and how many have actually created an Incident?

Thank you!  

1 ACCEPTED SOLUTION

Zahi Boussiba
ServiceNow Employee
ServiceNow Employee

Hi,

 

The relevant developer APIs and docs are available here:

https://developer.servicenow.com/dev.do#!/reference/api/rome/client/SNAnalyticsClientAPI

 

Please note that the APIs are supported for Quebec as well.

 

Kind regards,

Zahi

View solution in original post

2 REPLIES 2

Zahi Boussiba
ServiceNow Employee
ServiceNow Employee

Hi,

 

The relevant developer APIs and docs are available here:

https://developer.servicenow.com/dev.do#!/reference/api/rome/client/SNAnalyticsClientAPI

 

Please note that the APIs are supported for Quebec as well.

 

Kind regards,

Zahi

Shaily
Giga Expert

Custom events on user experience analytics

 

UX analytics for service portal automatically tracks pages and has got few OOB events to track user clicks.

Sometimes these OOB features do not provide the whole picture of user's interaction with the portal.

 

In this scenario we can make use of SNAnalytics - Client API and add custom events to our widgets.

 

One of the use cases of adding a custom event would be on Employee Center Portal, all topics are visible on the page emp_taxonomy_topic and it gets tracked under UI Analysis>Pages module on the UX analytics dashboard, in which we cannot determine which topic page was actually opened.

 

Another use case could be adding trackers to the custom widgets, in which tracking wouldn't be enabled OOB.

 

CUSTOM EVENT ADDITION

The event can be added to the client controller of the widget. Include snAnalytics to the api.controller definition(line 1)

api.controller = function($rootScope, $timeout, cabrillo , snAnalytics) {

 

And then add the custom event to the widget

var payload = {};

payload.name = "View Topic";//can change event name

payload.data = {};

payload.data["Record Item"] = c.data.topic.name; // the attribute Record Item can be changed to any value

payload.data["Record ID"] = c.data.topic.id; // the attribute Record Item can be changed to any value

snAnalytics.addEvent(payload);

 

Result on the UX analytics dashboard

 

View Topic.jpg