Removes all session information stored in the browser (e.g., analytics visitor cookies, action history, etc.)
Return the debug info about this component.
Disables the component and clears local data by running clearLocalData
.
Re-enables the component if it was previously disabled.
Return the bindings, or environment, for the current component.
Get the Origin Context dimension on the analytic events.
Get the Origin Context dimension on the analytic events.
Logs a Click
usage analytics event.
A Click
event corresponds to an item view (e.g., clicking on a ResultLink or opening a
Quickview).
Click
events are immediately sent to the Coveo Usage Analytics service.
Note:
When logging custom
Click
events, you should use theCoveo.logClickEvent
top-level function rather than calling this method directly from theAnalytics
component instance. See Logging Your Own Click Events.
The cause of the event.
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
service automatically converts uppercase characters to lowercase characters in key names. Each value must be a
simple string. You do not have to pass an IAnalyticsDocumentViewMeta as meta when logging a Click
event.
You can actually send any arbitrary meta. If you do not need to log metadata, you can simply pass an empty JSON
( {}
).
The result that was clicked.
The HTMLElement that the user has clicked in the interface. Default value is the element on which
the Analytics
component is bound.
Logs a Custom
usage analytics event on the service.
You can use Custom
events to create custom reports, or to track events which are neither queries (see
logSearchEvent
and
logSearchAsYouType
), nor item views (see
logClickEvent
).
Note:
When logging
Custom
events, you should use theCoveo.logClickEvent
top-level function rather than calling this method directly from theAnalytics
component instance. See Logging Your Own Custom Events.
The cause of the event.
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
service 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
( {}
).
The HTMLElement that the user has interacted with for this custom event. Default value is the
element on which the Analytics
component is bound.
The IQueryResult that the custom event is linked to, if any.
Logs a SearchAsYouType
usage analytics event.
This method is very similar to the logSearchEvent
method, except that
logSearchAsYouType
should, by definition, be called more frequently. Consequently, in order to avoid logging
every single partial query, the PendingSearchAsYouTypeEvent
takes care of logging only the "relevant" last event:
an event that occurs after 5 seconds have elapsed without any event being logged, or an event that occurs after
another part of the interface triggers a search event.
It is important to call this method before executing the query. Otherwise, no SearchAsYouType
event will be
logged, and you will get a warning message in the console.
Note:
When logging custom
SearchAsYouType
events, you should use theCoveo.logSearchAsYouTypeEvent
top-level function rather than calling this method directly from theAnalytics
component instance. See Logging Your Own Search Events.
The cause of the event.
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
service 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
( {}
).
Logs a Search
usage analytics event.
A Search
event is actually sent to the Coveo Usage Analytics service only after the query successfully returns
(not immediately after calling this method). Therefore, it is important to call this method before executing
the query. Otherwise, the Search
event will not be logged, and you will get a warning message in the console.
Note:
When logging custom
Search
events, you should use theCoveo.logSearchEvent
top-level function rather than calling this method directly from theAnalytics
component instance. See Logging Your Own Search Events.
The cause of the event.
The metadata 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
service 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
( {}
).
Attempts to push data representing a single Coveo usage analytics event to the Google Tag Manager data layer.
Note:
If the autoPushToGtmDataLayer
option is set to true
and the GTM data layer has been properly initialized in the page, this method is called automatically whenever an event is about to be logged to the Coveo Cloud usage analytics service.
See also the gtmDataLayerName
option.
The data to push.
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" and "CommunitySearch"
Default value is Search
.
The origin context value
Get the bound component to the given HTMLElement. Throws an assert if the HTMLElement has no component bound, unless using the noThrow argument.
If there is multiple component bound to the current HTMLElement, you must specify the component class.
HTMLElement for which to get the bound component.
Optional component class. If the HTMLElement has multiple components bound, you must specify which one you are targeting.
Boolean option to tell the method to not throw on error.
Allows the component to bind events and execute them only when it is enabled.
A reference to the AnalyticsClient
, which performs the heavy duty part of sending the usage analytics events to
the Coveo Usage Analytics service.
Contains the state of options for different components. Mainly used by ResultLink.
Contains the state of different components (enabled vs disabled). Allows to get/set values. Triggers component state event when modified. Each component can listen to those events.
A disabled component will not participate in the query, or listen to ComponentEvents.
Allows component to log in the dev console.
Contains the singleton that allows to trigger queries.
Contains the state of the query. Allows to get/set values. Trigger query state event when modified. Each component can listen to those events.
A reference to the root HTMLElement (the SearchInterface).
A reference to the root of every component, the SearchInterface.
The static ID that each component needs in order to be identified.
For example, SearchButton -> static ID: SearchButton -> className: CoveoSearchButton
A reference to the Analytics.client.
Specifies whether to convert search user identities to unique hash when logging analytics data, so that analytics reviewers and managers will not be able to clearly identify which user is performing which query.
When you set this option to true
, the Coveo Usage Analytics service can still properly differentiate sessions
made by anonymous users from sessions made by users authenticated in some way on the site containing the search
page.
Default value is false
.
data-anonymous='true' data-anonymous='false'
Whether to automatically attempt to push Coveo usage analytics events to the Google Tag Manager data layer.
See also gtmDataLayerName
.
data-auto-push-to-gtm-data-layer='true' data-auto-push-to-gtm-data-layer='false'
Specifies the URL of the Usage Analytics service. You do not have to specify a value for this option, unless the location of the service you use differs from the default Coveo Cloud Usage Analytics endpoint.
By default, the value is https://analytics.cloud.coveo.com/rest/ua
, or
https://analytics-<REGION_ABBREVIATION>.cloud.coveo.com/rest/ua
if you have
configured your search endpoint to implement
data residency outside of the United States.
data-endpoint='foo'
The name of the Google Tag Manager data layer initialized in the page.
See also autoPushToGtmDataLayer
.
Note: Setting this option is only useful if the GTM data layer was renamed in the page.
Default: dataLayer
data-gtm-data-layer-name='foo'
Specifies the organization bound to the access token. This is necessary when using an access token, because a single access token can be associated to more than one organization.
Default value is undefined
, and the value of this parameter will fallback to the organization used for the
search endpoint.
data-organization='foo'
Sets the Search Hub dimension on the search events.
The Search Hub dimension is typically a name that refers to a specific search page. For example, you could use
the CommunitySite
value to refer to a search page on a public community site.
Note:
If you wish to use the search hub dimension for security reasons (e.g., to provide different query suggestions for internal and external users), you should specify the search hub when generating the search token for the end user (in safe, server-side code), rather than setting it with this option (see Search Token Authentication).
Default value is default
.
data-search-hub='foo'
Specifies the name of the split test run that the search page is part of.
You can use this dimension to perform A/B testing using different search page layouts and features inside the Coveo Query pipeline.
Default value is undefined
and no split test run name is reported to the Coveo Usage Analytics service.
data-split-test-run-name='foo'
Specifies the version name for the page when a split test run is active.
When reporting on A/B testing analytics data, this value specifies the test run version name that was presented to the user.
Default value is undefined
data-split-test-run-version='foo'
Specifies the token to use to access the usage analytics endpoint.
Default value is undefined
, and the component uses the search token.
data-token='foo'
Specifies the name of the user for the usage analytics logs.
Default value is undefined
data-user='foo'
Specifies the user display name for the usage analytics logs.
Default value is undefined
data-user-display-name='foo'
Creates a new Analytics
component. Creates the AnalyticsClient
.
The HTMLElement on which the component will be instantiated.
The options for the Analytics
component.
The bindings that the component requires to function normally. If not set, these will be automatically resolved (with a slower execution time).
The
Analytics
component can log user actions performed in the search interface and send them to a REST web service exposed through the Coveo Cloud Platform.You can use analytics data to evaluate how users are interacting with your search interface, improve relevance and produce analytics dashboards within the Coveo Cloud Platform.
See JavaScript Search Framework Usage Analytics for an introduction.
See also Logging Your Own Search Events for more advanced use cases.