Web Analytics API Documentation
The Cadenza Web Analytics API allows you to track user actions by listening to analytics events dispatched by Cadenza.
The API is exposed on the global window.Disy.webAnalyticsApi object, which is an EventTarget.
You can use it to integrate with web analytics platform such as Matomo, Google Analytics, or similar tools.
Events
The API dispatches a single event type: action.
Each action event is a CustomEvent whose detail property contains information about the tracked user action.
Event Detail Properties
Every event detail includes the following base properties:
| Property | Type | Description |
|---|---|---|
|
|
High-level category of the event (e.g., |
|
|
Specific action or type within the category (e.g., |
Export Events
For export events, the category is always 'export'.
The following additional properties are available:
| Property | Type | Description |
|---|---|---|
|
|
The export format. One of: |
|
|
The type of entity being exported. One of: |
|
|
The display name of the entity being exported. |
|
|
The display name of the workbook. |
|
|
The display name of the worksheet. Not available when entityType is a 'workbook'. |
Usage
To consume the API, register an event listener on the window.Disy.webAnalyticsApi object in your theming template:
window.Disy.webAnalyticsApi.addEventListener('action', (event) => {
const { category, action, entityType, entityPrintName, reportTemplatePrintName } = event.detail;
// Process the event with your analytics platform
});
Example: Matomo Integration
The following example shows how to forward Cadenza analytics events to Matomo using the Matomo JavaScript Tracking API:
window.Disy.webAnalyticsApi.addEventListener('action', (event) => {
const { category, action, entityType, entityPrintName, workbookPrintName, reportTemplatePrintName } = event.detail;
_paq.push(['trackEvent', category, action, `${entityType}: [${entityPrintName}] | workbook: [${workbookPrintName}]${reportTemplatePrintName != null ? ` | report: [${reportTemplatePrintName}]` : ''}`]);
});
In this example, the Matomo trackEvent call is constructed as follows:
-
Event Category: The
categoryvalue (e.g.,'export'). -
Event Action: The
actionvalue (e.g.,'csv','curated_report'). -
Event Name: A concatenation of
entityType,entityPrintName, and optionallyreportTemplatePrintName.
Instead of concatenating extra details into the event name field, consider using Matomo’s Custom Dimensions feature to track entityType, entityPrintName, and reportTemplatePrintName as separate dimensions for more flexible analysis.
|