UBM - Insights

Analytics

setUserRole :method

This method allows you to define a user role that can be used as a dimension in Analytics.

The user role is saved only when the Custom Analytics feature is active at the application level and user role recording is enabled.

Method Signature

setUserRole(configuration);

Arguments

The configuration object supports the following property:

PropertyTypeDescriptionRequired
userRolestringSpecifies the user's role to be evaluated in Analytics.Yes

Code Sample

var configuration = {userRole: "Administrator"};

window.appnaviApi.analytics.setUserRole(configuration);

console.log("User role set as", configuration.userRole);

ubmConfiguration :method

This method allows you to configure User Behavior Monitoring (UBM) settings for your application.

It accepts a configuration object that specifies whether UBM event capturing should be enabled or disabled.

Method Signature

ubmConfiguration(configuration);

Arguments

The configuration object supports the following property:

PropertyTypeDescriptionRequired
captureEventsbooleanSpecifies whether UBM event capturing should be enabled for the application.No

Code Sample

var configuration = {captureEvents: true};

window.appnaviApi.analytics.ubmConfiguration(configuration);

console.log("Capture events set as", configuration.captureEvents);

UBM Push Event API

The UBM Push Event API allows users to send customized events to User Behavior Monitoring (UBM).

Certain elements may not be recorded during mining because of their customized nature. The Push Event API can be used to send these events to UBM manually.

Multiple UBM events can be sent in a single request using the events array.

For more details, see the UBM Push Event API documentation.

Event Object

[ubmEvent]

The event object supports the following properties:

PropertyTypeDescriptionRequired
eventTypestringSpecifies the type of event. Supported values are RIGHT_CLICK, LEFT_CLICK, and PAGE_LOAD.Yes
areaLabelstringSpecifies custom text used as the area label.No
elementLabelstringSpecifies custom text used as the element label.No
tagTypestringSpecifies the category or type of tag associated with the event.Yes

Code Sample

let ubmEvent = {
    eventType: "RIGHT_CLICK",
    areaLabel: "This is area",
    elementLabel: "This is element label",
    tagType: window.appnaviApi.tagType.button
};

window.appnaviApi.analytics.pushEvent({
    type: "ubm",
    events: [ubmEvent]
});

setCustomFieldValue :method

This method allows you to add additional information to User Behavior Monitoring (UBM) events within your application.

The custom field values can be used for purposes such as data export and analysis based on the provided information.

Method Signature

setCustomFieldValue(configuration);

Arguments

The configuration object supports the following properties.

Each custom field value must not exceed 32 characters. If a value exceeds 32 characters, it is truncated to 32 characters.

PropertyTypeDescriptionRequired
customField_1stringSpecifies additional information to include with the UBM event.No
customField_2stringSpecifies additional information to include with the UBM event.No
customField_3stringSpecifies additional information to include with the UBM event.No

Code Sample

var configuration = {
    customField_1: "Engineer",
    customField_2: "19c19162-c760-47be-a6b9-cae88e562f2d"
};

window.appnaviApi.analytics.setCustomFieldValue(configuration);

console.log("UBM custom fields set as", configuration);

Custom Push Event API

The Custom Push Event API allows users to send customized events based on their application's requirements.

Before using this API, the required custom event configuration must be created in the AppNavi Portal.

For more details, see the Custom Push Event API documentation.

Configuration Object

The configuration object supports the following properties:

PropertyTypeDescriptionRequired
eventTypestringSpecifies the type of event. Custom events must use the CUSTOM: prefix.Yes
pageUrlstringSpecifies the URL of the page where the event occurs.No
pageTitlestringSpecifies the title of the page where the event occurs.No
customField_1stringSpecifies a user-defined custom field for additional data.No
customField_2stringSpecifies a user-defined custom field for additional data.No
customField_3stringSpecifies a user-defined custom field for additional data.No

Code Sample

let ubmEvent = {
    eventType: "CUSTOM:BUTTON_CLICK",
    pageUrl: "https://example.com/dashboard",
    pageTitle: "Dashboard",
    customField_1: "User clicked on the submit button",
    customField_2: "Button color: Blue",
    customField_3: "Time spent on page: 5 minutes"
};

window.appnaviApi.analytics.pushEvent({
    type: "ubm",
    events: [ubmEvent]
});

Did this page help you?