GM - Interaction Logger
(gmpkg:interactionLoggerLWC)
Documentation
GM - Interaction Logger component is a utility component that tracks user interactions from a UI perspective. Enabling User Interactions is a prerequisites to use the logger.
Use case: Track the page load for a specific app or a specific audience (User, Profile). The logger can be used from the app build or from a Lightning component (Aura/LWC).
Specification
Message
String
JSON Message structure to track, ensure it includes the following elements:
eventType: Event type. should be set to 'Interaction'. Other event types will be added in the future.
interactionName: Interaction name
interactionLabel: Interaction label
componentType: Component type.
componentName: Component name.
componentLabel: Component label.
namespacePrefix: Namespace prefix.
API Reference
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>60.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>GM - Interaction Logger</masterLabel>
<description>GM - Interaction Logger</description>
<targets>
<target>lightning__RecordPage</target>
<target>lightning__AppPage</target>
<target>lightning__HomePage</target>
</targets>
<targetConfigs>
<targetConfig targets="lightning__RecordPage,lightning__AppPage,lightning__HomePage">
<property
name="jsonMessage"
type="String"
label="Message"
description="JSON Message to track. The message should have an eventType, componentType, componentName, componentCode, componentLabel, interactionName, interactionLabel and namespacePrefix "
/>
</targetConfig>
</targetConfigs>
</LightningComponentBundle>
LWC Implementation
To leverage the interaction logger in your LWC component, the logger should be wrapped in the markup as below:
<gmpkg-interaction-logger-l-w-c lwc:ref="interactionLogger">
</gmpkg-interaction-logger-l-w-c>
The interaction logger exposes a public api publishEvent. To publish an event, just call the api and pass the message payload as a JSON object.
logInteraction(actionName, actionLabel) {
let interactionLogger = this.refs.interactionLogger;
if(interactionLogger){
interactionLogger.publishEvent({
eventType: 'Interaction',
componentType: 'GM_FieldSetGrid',
componentName: 'Opp_FieldSet_Grid',
componentLabel: 'Open Opportunities',
interactionName: actionName,
interactionLabel: actionLabel,
namespacePrefix: 'gmpkg'
});
}
}
Last updated
Was this helpful?