Workspace events to log for analytics
Analytics can be an essential tool to help understand app usage, end-to-end workflows, performance, and more. Workspace Analytics supports your analysis needs with workspace platform events that you can log or otherwise write to your analytics solution.
How it works
The WorkspacePlatformProvider
interface provides a handleAnalytics
method that takes an AnalyticsEvent
parameter object. This method is called when the events documented in this article are emitted. It's up to the provider to create an implementation to write the event information to the appropriate location.
You write these events to your preferred logging or analytics solution, or to console.log
.
The
AnalyticsEvent
object does not include a timestamp. Events are typically passed to thehandleAnalytics
method when they are emitted, so you can add the timestamp of each event to your preferred logging or analytics implementation.
The AnalyticsEvent
type declaration:
export type AnalyticsEvent = {
source: AnalyticsSource;
type: string;
action: string;
value?: string;
entityId?: OpenFin.Identity;
data?: any;
};
Where:
-
source
= the Workspace component the event was emitted from. One of:export enum AnalyticsSource { Browser = 'Browser', Dock = 'Dock', Home = 'Home', Notification = 'Notification', Storefront = 'Storefront', Platform = 'Platform', Theming = 'Theming', Interop = 'Interop' }
-
type
= the UI element the Workspace user interacted with -
action
= the user interaction that fired the event -
value
= the result of the user interaction. Depending on the user interaction, this field might not be populated (optional). -
entityId
= depending on the user interaction, the UUID of the result, the name of the result, or both (optional). -
data
= any additional information the provider includes in an object that emits a Workspace event (optional).
How to do it
Start with a Workspace platform override:
import * as WorkspacePlatform from '@openfin/workspace-platform';
const overrideCallback: WorkspacePlatform.WorkspacePlatformOverrideCallback = async (
WorkspacePlatformProvider
) => {
class Override extends WorkspacePlatformProvider {
handleAnalyticsEvent = async (event: WorkspacePlatform.AnalyticsEvent[]) => {
// do something with the event
};
}
return new Override();
};
await WorkspacePlatform.init({ overrideCallback });
Then handle the emitted events as your analytics solution requires.
An example that writes events to the console is provided as part of the customize-workspace example in the workspace-starter GitHub repository.
Events list
The following table lists the required fields of the AnalyticsEvent
object plus the entityId where available.
source | type | action | entityId | event description |
---|---|---|---|---|
Home | Navigation | Show | Platform UUID | User displayed Home, entered search term, and pressed enter. |
Home | Result | Select | Search Result ID, Search Result Title | Search result selected. |
Home | Filter | Select | Filter Value | Search results filtered. |
Browser | Window | Open | Window UUID, Window Name | |
Browser | Window | Close | Window UUID, Window Name | |
Browser | Page | Open | Page/Tab UUID, Page/Tab Name | |
Browser | Page | Close | Page UUID, Page Name | |
Browser | Toolbar | New Page | Page UUID, Page Name | |
Browser | Page Tab | Drag | Page/Tab UUID, Page/Tab Name | Page moved to change window layout. |
Browser | View | Open | View UUID, View Name | |
Browser | View | Close | View UUID, View Name | |
Browser | View Tab | Drag | View UUID, View Name | View moved to change window layout. |
Browser | Menu | Global | Context menu of browser window selected. | |
Browser | Global | Item Name | Menu item of browser window context menu selected. | |
Browser | Menu | Page Tab | Page context menu selected. | |
Browser | Page Tab | Item Name | Menu item of page context menu selected. | |
Browser | Menu | View Tab | View context menu selected. | |
Browser | View Tab | Item Name | Menu item of view context menu selected. | |
Browser | Toolbar | Item or Item Button | Browser toolbar item selected. | |
Browser | Item Button | Item Name | Menu item of browser toolbar selected. | |
Browser | Modal | Button | Item Name | |
Browser | Interop | join-group: | App Name | |
Notifications | Platform | Select | Platform UUID | |
Notifications | Center | Clear All | Platform ID, Notification Title | |
Notifications | Center | Clear | Platform ID, Notification Title | |
Notifications | Toast | Remove | Platform ID, Notification Title | |
Notifications | Toast | ButtonClick | Platform ID, Notification Title, Button Label Name | |
Notifications | Center | Menu Item | Item Name | |
Notifications | Settings | Change | Setting Type, Setting Value | Setting the user changed: which setting, and what changed. |
Dock | Navigation | Select | Dock Item name | Item selected in Dock. |
Dock | Navigation | Switch Platform | Platform UUID | Platform user switched to from Dock. |
Dock | Navigation | Switch Workspace | Workspace Name | |
Dock | More Menu | Select | Item Name | |
Dock | Navigation | Select | Home, Store, NC | |
Store | Hero | Select | Asset Name | Hero selected from Storefront. |
Store | Landing | Select | Asset Name | Store item selected from the landing page. |
Store | Landing | Launch | Asset Name | App launched from the landing page. |
Store | Left Panel | Select | Asset Name | App grid selected from the left pane navigation. |
Store | App Grid | Select | Asset Name | App preview selected. |
Store | App Grid | Launch | Asset Name | App launched from the app grid. |
Store | App Preview | Launch | Asset Name | App launched from the app preview. |
Updated 2 months ago