@elastic/search-ui-analytics-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.22.0 • Public • Published

Search UI Analytics Plugin

Use the Analytics Plugin to send analytics events to the Behavioral Analytics Product. Follow the instructions to set up the plugin.

Installation

yarn add @elastic/search-ui-analytics-plugin
## OR
npm install @elastic/search-ui-analytics-plugin

Basic Usage

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.

Passing in a custom analytics client

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()
    })
  ]
}

Options

The Analytics Plugin accepts the following options:

Option Type Description Default
client AnalyticsTracker The Behavioral Analytics client to use. Read more on Behavioral Analytics Tracker repo window.elasticAnalytics

Readme

Keywords

none

Package Sidebar

Install

npm i @elastic/search-ui-analytics-plugin

Weekly Downloads

1,751

Version

1.22.0

License

Apache-2.0

Unpacked Size

24.6 kB

Total Files

11

Last publish

Collaborators

  • jen-huang
  • delvedor
  • lukasolson
  • ccowan
  • jbudz
  • thomasneirynck
  • verogo
  • weltenwort
  • pugnascotia
  • zinckiwi
  • brandon.kobel
  • nreese
  • mgreau
  • jonahbull
  • jarpy
  • leathekd
  • lukeelmers
  • ddillinger
  • joshdover
  • jasonstoltz
  • bamieh
  • markov00
  • joshmock
  • vignesh.shanmugam
  • watson
  • rhodesjason
  • jmlrt
  • mattkime
  • constancecchen
  • afoucret
  • nickpeihl
  • axw
  • mistic
  • elasticmachine
  • gtback
  • pickypg
  • trentm
  • andrewvc-elastic
  • jorge.sanz
  • stratoula
  • nkammah
  • streamich
  • nickofthyme
  • chloeruka
  • phoey1
  • breehall
  • kyrspl
  • johnwcambra
  • colleen.mcginnis
  • legrego
  • banerjeesoham004
  • patryk.kopycinski
  • kibanamachine
  • tkajtoch
  • cindy_c
  • cbishopewc
  • lenegadewoll
  • asnyder-elastic
  • lgestc
  • weronika-olejniczak
  • elena-shostak
  • kc13greiner
  • yan.savitski
  • jeramysoucy
  • miguel-elastic
  • bradtimmerman
  • obltmachine
  • jbwelastic
  • acstll