Class sap.ushell.services.UsageAnalyticsModule: sap/ushell/services/UsageAnalytics


A UShell service for tracking business flows and user actions.

The UsageAnalytics service exposes API for logging custom events and setting custom field values in the logged events.
The data is sent via http and recorded on a server, whose URL is defined by the baseUrl service configuration property.
The service configuration must also include the site ID from the pubToken attribute.
You can find the pubToken in the code snippet provided in the WARP when creating a new site.

Each tracked event is represented by a table entry on the server database.
The administrator can produce reports based on the the recorded data.

Two types of events can be logged:
- Automatic events: Click or pageLoad are predefined events, logged by the base tracking library.
You can disable these events in the service configuration.
- Custom events: You can use the service API to log an event with custom data using the function logCustomEvent

Each tracked event (either automatic or custom) is represented by a database row, that includes 10 custom attributes named custom1...custom10.
Some of these values can be set using UsageAnalytics service API.


Since: 1.32.0.
Constructor Summary
new sap.ushell.services.UsageAnalytics(oContainerInterface, sParameter, oServiceProperties)
Method Summary
setCustomAttributes(oCustomFieldValues)Sets up to 6 customer attributes of logged events according to the given object attributes.
setLegalText()Enables the renderer to set the content of the legal message.
systemEnabled()Indicates whether the service is available.
userEnabled()Indicates whether the user has specified to track activities.
Constructor Detail
new sap.ushell.services.UsageAnalytics(oContainerInterface, sParameter, oServiceProperties)
Parameters:
{object}oContainerInterface The interface provided by the container
{object}sParameter Not used in this service
{object}oServiceProperties Service configuration
See:
sap.ushell.services.Container#getService
Method Detail
setCustomAttributes(oCustomFieldValues)
Sets up to 6 customer attributes of logged events according to the given object attributes.
A customer attribute can be set only once during a session.
Currently these attributes correspond to database columns custom5...custom10.
Parameters:
{object}oCustomFieldValues An json object that includes attribute1...attribute6 (or subset)
with values of type string/number/boolean or a function that returns any of these types.
For example:
{
attribute1: "value3",
attribute2: function () {return "value4"},
attribute3: 55
}
in this example the custom field "custom5" gets the string "value3"
the custom field custom6 gets the function that returns the string "value4",
the custom field custom7 gets a string "55".
Any property of oCustomFieldValues which is not in the range of attribute1...attribute6 is ignored.
Since:
1.32.0
setLegalText()
Enables the renderer to set the content of the legal message..
Since:
1.32.0
systemEnabled(): boolean
Indicates whether the service is available.

Returns true if the following conditions exist, and false otherwise:
a) Service configuration property enable is set to true
b) Service configuration property pubToken is not empty
c) Agreement text exists or setUsageAnalyticsPermitted is set to false
Since:
1.32.0
Returns:
{boolean} A boolean value indicating whether the UsageAnalytics service is enabled
userEnabled(): boolean
Indicates whether the user has specified to track activities.

Returns true if the following conditions exist, and false otherwise:
a) The function system enabled returns true
b) The user property trackUsageAnalytics is set to true
Since:
1.32.0
Returns:
{boolean} A boolean value indicating whether the user has specified to track activities