Analytics Plugin
The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability This functionality is generally available and ready for production usage. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Stack
Generally available
The Behavioral Analytics feature was discontinued in Elastic 9.0.0.
Use the Analytics Plugin to send analytics events to the Behavioral Analytics Product. Follow the instructions to set up the plugin.
yarn add @elastic/search-ui-analytics-plugin
## OR
npm install @elastic/search-ui-analytics-plugin
Add the Analytics Plugin to your Search UI configuration like so:
import AnalyticsPlugin from "@elastic/search-ui-analytics-plugin";
// search ui configuration
const config = {
apiConnector: connector,
searchQuery: { ... },
plugins: [ AnalyticsPlugin() ]
}
By default, the Analytics Plugin will use the Behavioral Analytics client provided when using script tag integration.
If you integrated Behavioral Analytics using the @elastic/behavioral-analytics-javascript-tracker NPM package, you can pass in a custom analytics client to the Analytics Plugin.
import AnalyticsPlugin from "@elastic/search-ui-analytics-plugin";
import { createTracker, getTracker } from "@elastic/behavioral-analytics-javascript-tracker";
createTracker({
// the DSN can be found in the Behavioral Analytics Collections view page
dsn: "https://my-analytics-dsn.elastic.co"
})
// search ui configuration
const config = {
apiConnector: connector,
searchQuery: { ... },
plugins: [
AnalyticsPlugin({
client: getTracker()
})
]
}
The Analytics Plugin accepts the following parameters:
| Option | Type | Description | Default |
|---|---|---|---|
client |
AnalyticsTracker |
The Behavioral Analytics client to use. Read more on Behavioral Analytics Tracker repo | window.elasticAnalytics |