Support Menu

Interface IAnalyticsClient

Interface IAnalyticsClient

The IAnalyticsClient interface describes an analytics client that can log events to, or return information from the usage analytics service.

See also the Analytics component.

Index

Methods

getCurrentVisitIdPromise

  • getCurrentVisitIdPromise(): Promise

getTopQueries

isActivated

  • isActivated(): boolean

logClickEvent

  • Logs a Click event. You can understand click events as item views (e.g., clicking on a ResultLink or opening a Quickview).

    This event is logged immediately on the service.

    Type parameters

    • TMeta

    Parameters

    • actionCause: IAnalyticsActionCause

      Describes the cause of the event.

    • meta: TMeta

      The metadata which you want to use to create custom dimensions. Metadata can contain as many key-value pairs as you need. Each key must contain only alphanumeric characters and underscores. The Coveo Usage Analytics API automatically converts uppercase characters to lowercase characters in key names. Each value must be a simple string. You do not have to pass an AnalyticsDocumentViewMeta as meta when logging a custom Click event. You can actually send any arbitrary meta. If you do not need to log metadata, you can simply pass an empty JSON ( {} ).

    • result: IQueryResult

      The result that the user has clicked.

    • element: HTMLElement

      The HTMLElement that the user has clicked in the interface.

    Returns void

logCustomEvent

  • Logs a custom event on the service. You can use custom events to create custom reports, or to track events that are not queries or item views.

    Type parameters

    • TMeta

    Parameters

    • actionCause: IAnalyticsActionCause

      Describes the cause of the event.

    • meta: TMeta

      The metadata which you want to use to create custom dimensions. Metadata can contain as many key-value pairs as you need. Each key must contain only alphanumeric characters and underscores. The Coveo Usage Analytics API automatically converts white spaces to underscores and uppercase characters to lowercase characters in key names. Each value must be a simple string. If you do not need to log metadata, you can simply pass an empty JSON ( {} ).

    • element: HTMLElement

      The HTMLElement that the user has interacted with for this custom event.

    Returns void

logSearchAsYouType

  • Logs a SearchAsYouType event on the service, using an AnalyticsActionCause and a meta object.

    This method is very similar to the logSearchEvent method, except that logSearchAsYouType is, by definition, more frequently called.

    The PendingSearchAsYouTypeEvent takes care of logging only the "relevant" last event (i.e., an event that occurs after 5 seconds elapse without any event being logged, or an event that occurs after another part of the interface triggers a search event). This avoids logging every single partial query, which would make reporting very confusing.

    It is important to call this method before executing the query. Otherwise the service will log no SearchAsYouType event and you will get a warning message in the console.

    See Sending Custom Analytics Events.

    Type parameters

    • TMeta

    Parameters

    • actionCause: IAnalyticsActionCause

      Describes the cause of the event.

    • meta: TMeta

      The metadata which you want to use to create custom dimensions. Metadata can contain as many key-value pairs as you need. Each key must contain only alphanumeric characters and underscores. The Coveo Usage Analytics API automatically converts white spaces to underscores and uppercase characters to lowercase characters in key names. Each value must be a simple string. If you do not need to log metadata, you can simply pass an empty JSON ( {} ).

    Returns void

logSearchEvent

  • Logs a Search event on the service, using an AnalyticsActionCause and a meta object.

    Note that the Search event is only sent to the service when the query successfully returns, not immediately after calling this method. Therefore, it is important to call this method before executing the query. Otherwise the service will log no search event and you will get a warning message in the console.

    See Sending Custom Analytics Events.

    Type parameters

    • TMeta

    Parameters

    • actionCause: IAnalyticsActionCause

      Describes the cause of the event.

    • meta: TMeta

      The metadata which you want to use to create custom dimensions. Metadata can contain as many key-value pairs as you need. Each key must contain only alphanumeric characters and underscores. The Coveo Usage Analytics API automatically converts white spaces to underscores and uppercase characters to lowercase characters in key names. Each value must be a simple string. If you do not need to log metadata, you can simply pass an empty JSON ( {} ).

    Returns void

setOriginContext

  • setOriginContext(originContext: string): any
  • Sets the Origin Context dimension on the analytic events.

    You can use this dimension to specify the context of your application.

    Suggested values are Search, InternalSearch, or CommunitySearch.

    Default value is Search.

    Parameters

    • originContext: string

      The origin context value.

    Returns any

Hierarchy

  • IAnalyticsClient