Skip to content

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:

ts
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

FieldDescriptionRequired
eventTypeType of event (Regular, Error, Exception, Duration).Required for all types
actionNameName of the action/event being tracked.Required for all types
payloadData sent with the action.Optional
isSuccessfulIndicates if the action was successful.Optional (Required with value false for Exception and Error events)
apiResponseSizeInKilobytesSize of the API response in kilobytes.Optional
apiResponseTimeInSecondsTime taken for the API response in seconds.Optional
apiResponseSizeInMegabytesSize of the API response in megabytes.Optional
startTimeStart time of the event.Required for Duration events
endTimeEnd time of the event.Required for Duration events
apiBaseUrlBase URL of the API.Optional
ValidationErrorsErrors during validation.Optional
ReasonForfailureReason for failure of the action.Required for Exception and Error events
apiUrlURL of the API.Required for Error events
apiStatusCodeStatus code returned by the API.Required for Error events
apiStatusStatus of the API request.Optional
apiMethodHTTP method used for the API request.Optional (Required for Error events)
apiRequestData sent in the API request.Required for Error events
apiResponseData received in the API response.Required for Error events
tapIdIdentifier for a specific UI tap action.Optional
uiTypeType of the user interface.Optional
tapShortNameShort name of the tap action.Optional
tapNameName of the tap action.Optional
appBuildNumberBuild number of the application.Optional
sectionNameName of the section within the application.Optional
integrationAppNameName of the integration app involved.Optional
appIdIdentifier for the application.Optional
traceIdIdentifier used for tracing requests and actions.Optional
osOperating system on which the action occurred.Optional
viewIdIdentifier for the specific view in the application.Optional
viewShortNameShort name of the view.Optional
searchResultFoundIndicates if the search yielded results.Optional
searchQueryThe search query entered by the user.Optional
searchShortNameShort name for the search action.Optional
searchIdIdentifier for the search action.Optional
searchNameName for the search action.Optional
productNameName of the product involved in the action.Optional
searchSelectedResultThe result selected from the search results.Optional
purchasePaymentTypeType of payment used in a purchase.Optional
purchaseErrorMessageError message received during a purchase, if any.Optional
purchasePaymentChannelPayment channel used in the purchase.Optional
purchaseAmountAmount involved in a purchase.Optional
pageNameName of the page where the action took place.Optional
viewNameName of the view where the action took place.Optional
customerNameName of the customer.Optional
customerEmailEmail of the customer.Optional
customerPhoneNumberPhone number of the customer.Optional
locationGeographic location of the customer.Optional
customerIdIdentifier for the customer.Optional
customerCountryCountry 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.