Analytic Event Logging
Analytics Events are events such as user interactions, custom events, and product metrics that are logged with additional context with the aim of providing insights into the product performance. The method follows a predefined structure that needs to be adhered to for consistency. To log a product event, use the logAnalyticsEvent
method on the HubtelEventPub
instance. See usage example below:
Usage
Here's an example of how to log analytic event:
eventPublisher.logAnalyticsEvent({
eventType: "Regular",
actionName: "Download_invoice",
customerName: "Prince Nketiah"
customerPhoneNumber: "0200000000",
customerCountry: "GH"
})
TIP
For detailed instructions on setting up the event publisher, refer to the documentation.
Object Properties
Field | Description | Required |
---|---|---|
eventType | Type of event (Regular, Error, Exception, Duration). | Required for all types |
actionName | Name of the action/event being tracked. | Required for all types |
payload | Data sent with the action. | Optional |
isSuccessful | Indicates if the action was successful. | Optional (Required with value false for Exception and Error events) |
apiResponseSizeInKilobytes | Size of the API response in kilobytes. | Optional |
apiResponseTimeInSeconds | Time taken for the API response in seconds. | Optional |
apiResponseSizeInMegabytes | Size of the API response in megabytes. | Optional |
startTime | Start time of the event. | Required for Duration events |
endTime | End time of the event. | Required for Duration events |
apiBaseUrl | Base URL of the API. | Optional |
ValidationErrors | Errors during validation. | Optional |
ReasonForfailure | Reason for failure of the action. | Required for Exception and Error events |
apiUrl | URL of the API. | Required for Error events |
apiStatusCode | Status code returned by the API. | Required for Error events |
apiStatus | Status of the API request. | Optional |
apiMethod | HTTP method used for the API request. | Optional (Required for Error events) |
apiRequest | Data sent in the API request. | Required for Error events |
apiResponse | Data received in the API response. | Required for Error events |
tapId | Identifier for a specific UI tap action. | Optional |
uiType | Type of the user interface. | Optional |
tapShortName | Short name of the tap action. | Optional |
tapName | Name of the tap action. | Optional |
appBuildNumber | Build number of the application. | Optional |
sectionName | Name of the section within the application. | Optional |
integrationAppName | Name of the integration app involved. | Optional |
appId | Identifier for the application. | Optional |
traceId | Identifier used for tracing requests and actions. | Optional |
os | Operating system on which the action occurred. | Optional |
viewId | Identifier for the specific view in the application. | Optional |
viewShortName | Short name of the view. | Optional |
searchResultFound | Indicates if the search yielded results. | Optional |
searchQuery | The search query entered by the user. | Optional |
searchShortName | Short name for the search action. | Optional |
searchId | Identifier for the search action. | Optional |
searchName | Name for the search action. | Optional |
productName | Name of the product involved in the action. | Optional |
searchSelectedResult | The result selected from the search results. | Optional |
purchasePaymentType | Type of payment used in a purchase. | Optional |
purchaseErrorMessage | Error message received during a purchase, if any. | Optional |
purchasePaymentChannel | Payment channel used in the purchase. | Optional |
purchaseAmount | Amount involved in a purchase. | Optional |
pageName | Name of the page where the action took place. | Optional |
viewName | Name of the view where the action took place. | Optional |
customerName | Name of the customer. | Optional |
customerEmail | Email of the customer. | Optional |
customerPhoneNumber | Phone number of the customer. | Optional |
location | Geographic location of the customer. | Optional |
customerId | Identifier for the customer. | Optional |
customerCountry | Country of the customer. | Optional |
Data Visibility on Datadog
The data logged using the logAnalyticsEvent
method will be visible directly on Datadog’s platform. You can monitor and analyze these logs and user interactions through Datadog's web interface. Typically, dashboards are built from these logs to provide insights into the product and application performance.
Go to the Datadog website to learn more about how to set up and use Datadog for monitoring and analytics.
The next section will provide detail on developer logs.
Was this helpful? 📚
CHAT SAMMIAT