{"id":29020374,"url":"https://github.com/appbaseio/analytics.js","last_synced_at":"2025-06-26T01:05:30.333Z","repository":{"id":41786161,"uuid":"217286775","full_name":"appbaseio/analytics.js","owner":"appbaseio","description":"Universal analytics library for appbase.io / ElasticSearch","archived":false,"fork":false,"pushed_at":"2023-10-27T04:36:52.000Z","size":2124,"stargazers_count":3,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-19T03:06:40.555Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appbaseio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-24T11:51:27.000Z","updated_at":"2024-07-31T09:37:07.000Z","dependencies_parsed_at":"2024-06-19T00:21:51.301Z","dependency_job_id":"f8cf1a48-debf-4ae4-b01a-5a86ea92b9d9","html_url":"https://github.com/appbaseio/analytics.js","commit_stats":null,"previous_names":["appbaseio/appbase-analytics","appbaseio/analytics"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/appbaseio/analytics.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appbaseio%2Fanalytics.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appbaseio%2Fanalytics.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appbaseio%2Fanalytics.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appbaseio%2Fanalytics.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appbaseio","download_url":"https://codeload.github.com/appbaseio/analytics.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appbaseio%2Fanalytics.js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261978910,"owners_count":23239417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-26T01:05:29.125Z","updated_at":"2025-06-26T01:05:30.305Z","avatar_url":"https://github.com/appbaseio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM Version](https://img.shields.io/npm/v/@appbaseio/analytics.svg?style=flat)](https://www.npmjs.com/package/@appbaseio/analytics)\n\n### Appbase Analytics\n\nA universal analytics library that allows you to record search, click and conversion for appbase.io \u003cb\u003eclusters\u003c/b\u003e.\n\n## TOC\n\n- [Getting started](#getting-started)\n  - [Browser](#browser)\n  - [Node.js](#nodejs)\n- [Use cases](#use-cases)\n  - [Record search](#record-search)\n    - [Record empty query search](#record-empty-query-search)\n  - [Record clicks](#record-clicks)\n    - [Record suggestion clicks](#record-suggestion-clicks)\n    - [Record clicks for a particular search event](#record-clicks-for-a-particular-search-event)\n    - [Record clicks with particular events](#record-clicks-with-particular-events)\n  - [Record conversions](#record-conversions)\n  - [Save search](#save-search)\n  - [Get Saved searches](#get-saved-searches)\n  - [Favorite](#favorite)\n  - [Get Favorites](#get-favorites)\n  - [Set user](#set-user)\n  - [Set global events](#set-global-events)\n- [API Reference](#api-reference)\n- [Contributing](#contributing)\n- [Other Projects You Might Like](#other-projects-you-might-like)\n- [License](#license)\n\n## Getting started\n\n### Browser\n\n#### 1. Load the library\n\nThe analytics library can be either loaded via [jsDelivr CDN](https://www.jsdelivr.com/) or directly bundled with your application.\n\nYou can use the UMD build in browsers by following the below snippet:\n\n\u003c!-- prettier-ignore-start --\u003e\n```html\n\u003cscript defer src=\"https://cdn.jsdelivr.net/npm/@appbaseio/analytics@2.0.0-beta.2/dist/@appbaseio/analytics.umd.min.js\"\n\u003e\u003c/script\u003e\n```\n\u003c!-- prettier-ignore-end --\u003e\n\n#### 2. Initialization\n\n```js\nconst aaInstance = aa.init({\n  index: 'INDEX_NAME',\n  credentials: 'AUTH_CREDENTIALS',\n  url: 'CLUSTER_URL'\n});\n```\n\n### Node.js\n\n#### 1. Install the library\n\nInstall the library by following the below command:\n\n```bash\nnpm install @appbaseio/analytics\n# or\nyarn add @appbaseio/analytics\n```\n\n#### 2. Initialization\n\n```js\nconst aa = require('@appbaseio/analytics');\n\nconst aaInstance = aa.init({\n  index: 'INDEX_NAME',\n  credentials: 'AUTH_CREDENTIALS',\n  url: 'CLUSTER_URL'\n});\n```\n\n[⬆ Back to Top](#appbase-analytics)\n\n## Use cases\n\nThe analytics library provides the utility methods to integrate the appbase.io analytics in minutes, the common use-cases are to record the search, clicks and conversion events.\n\n### Record search\n\nIt helps you to track the search for a particular query term. It returns the `queryID` back which can be used to record clicks and conversions for the same search event.\n\n```js\nconst aa = require('@appbaseio/analytics');\n\nconst aaInstance = aa.init({\n  index: 'INDEX_NAME',\n  credentials: 'AUTH_CREDENTIALS',\n  url: 'CLUSTER_URL'\n});\n\naaInstance.search({\n  query: 'iphone'\n});\n```\n\n\u003cb\u003eNote:\u003c/b\u003e `queryID` will be automatically set in the state and can be retrieved by using the `getQueryID` method once a search event has been registered successfully.\n\n#### Record empty query search\n\n`query` is the required key to record a search event however you can set it to empty string to register as an empty query search.\n\n```js\naaInstance.search({\n  query: ''\n});\n```\n\n### Record clicks\n\nUse the `click` method to record click events. The below example records the two clicks of the `result` type for a search query.\n\n```ts\nconst aa = require('@appbaseio/analytics');\n\nconst aaInstance = aa.init({\n  index: 'INDEX_NAME',\n  credentials: 'AUTH_CREDENTIALS',\n  url: 'CLUSTER_URL'\n});\n\naaInstance.click({\n  query: 'iphone',\n  objects: {\n    iphoneX_19348: 1,\n    iphone7_19348: 3\n  },\n  meta: {\n    key1: 'value1'\n  }\n});\n```\n\n#### Record suggestion clicks\n\nSet the `isSuggestionClick` property to `true` to record as suggestion click.\n\n```ts\naaInstance.click({\n  query: 'iphone',\n  isSuggestionClick: true,\n  objects: {\n    iphoneX_19348: 1,\n    iphone7_19348: 3\n  }\n});\n```\n\n#### Record clicks for a particular search event\n\nUse `queryID` instead of `query` to record clicks for a particular search event.\n\n```ts\n// Record a search\naaInstance.search({\n  query: 'iphone'\n});\n\n// Record a click for the last search made\naaInstance.click({\n  queryID: aaInstance.getQueryID(),\n  objects: {\n    iphoneX_19348: 1,\n    iphone7_19348: 3\n  }\n});\n```\n\n#### Record clicks with particular events\n\nAttach the custom events to distinguish the click events.\n\n```ts\naaInstance.click({\n  query: 'iphone',\n  objects: {\n    iphoneX_19348: 1,\n    iphone7_19348: 3\n  },\n  customEvents: {\n    click_source: 'promoted_collections'\n  }\n});\n```\n\n### Record conversions\n\nConversions must be recorded for a particular search event so it is required to define a `queryID` to record conversion.\n\n```ts\n// Record a search\naaInstance.search({\n  query: 'iphone'\n});\n\n// Record a conversion for the last search made\naaInstance.conversion({\n  queryID: aaInstance.getQueryID(),\n  objects: ['iphoneX_19348', 'iphone7_19348'],\n  meta: {\n    key1: value1\n  }\n});\n```\n\n### Save search\n\nTo save a search state, `queryID` must be present.\n\n```ts\n// Save search state\naaInstance.saveSearch({\n  queryID: 'cf600405-d4ed-42b0-8b09-08b594fa88d2',\n  saveSearchID: 'analytics-js-test',\n  saveSearchMeta: {\n    key1: 'value1'\n  },\n  userID: 'john@appbase.io',\n  customEvents: { platform: 'mac' }\n});\n```\n\n### Delete Saved search\n\nTo delete a saved search state by Id.\n\n```ts\n// Save search state\naaInstance.deleteSavedSearch('analytics-js-test');\n```\n\n### Get Saved searches\n\nTo retrieve saved searches, here we're fetching the saved searches for user with user id as `john@appbase.io`.\n\n```ts\naa.getSavedSearches(\n  {\n    user_id: 'john@appbase.io'\n  },\n  (err, res) =\u003e {\n    if (err) {\n      console.error(err);\n    } else {\n      res\n        .json()\n        .then(savedSearches =\u003e {\n          // saved searches list\n        })\n        .catch(err =\u003e {\n          console.error(err);\n        });\n    }\n  }\n);\n```\n\n### Favorite\n\nTo record a favorite document\n\n```ts\naa.favorite({\n  favoriteOn: '1jftXXEBdEU4aeo6Gdqs',\n  queryID: 'cf600405-d4ed-42b0-8b09-08b594fa88d2',\n  source: {\n    authors: 'John Milton, John Leonard',\n    average_rating: 3.8,\n    average_rating_rounded: 4,\n    books_count: 819,\n    id: 984,\n    image: 'https://images.gr-assets.com/books/1455618673l/15997.jpg',\n    image_medium: 'https://images.gr-assets.com/books/1455618673m/15997.jpg',\n    isbn: '140424393',\n    language_code: 'eng',\n    original_publication_year: 1667,\n    original_series: '',\n    original_title: 'Paradise Lost',\n    ratings_count: 96316,\n    title: 'Paradise Lost'\n  },\n  id: 'analytics-js-test',\n  userID: 'john@appbase.io',\n  customEvents: { platform: 'mac' },\n  meta: {\n    key1: 'value1'\n  }\n});\n```\n\n### Get Favorites\n\nTo retrieve favorite documents, here we're fetching the favorites for user with user id as `john@appbase.io`.\n\n```ts\naa.getFavorites(\n  {\n    user_id: 'john@appbase.io'\n  },\n  (err, res) =\u003e {\n    if (err) {\n      console.error(err);\n    } else {\n      res\n        .json()\n        .then(favorites =\u003e {\n          // list of favorite document\n        })\n        .catch(err =\u003e {\n          console.error(err);\n        });\n    }\n  }\n);\n```\n\n### Set user\n\nIt allows you to set the `userID`.\n\n```ts\nconst aa = require('@appbaseio/analytics');\n\n// Set during initialization\nconst aaInstance = aa.init({\n  index: 'INDEX_NAME',\n  credentials: 'AUTH_CREDENTIALS',\n  url: 'CLUSTER_URL',\n  userID: 'jon@abc.com'\n});\n\n// or set by using method\naaInstance.setUserID('jon@abc.com');\n```\n\n### Set global events\n\nTo set the custom events which will be attached for each event recorded by the instance.\n\nFor example:\n\n```ts\nconst aa = require('@appbaseio/analytics');\n\nconst aaInstance = aa.init({\n  index: 'INDEX_NAME',\n  credentials: 'AUTH_CREDENTIALS',\n  url: 'CLUSTER_URL'\n});\n\n// or set by using method\naaInstance.setGlobalCustomEvents({\n  platform: 'ios'\n});\n```\n\n[⬆ Back to Top](#appbase-analytics)\n\n## API Reference\n\n### Initialization\n\n```js\nconst aa = require('@appbaseio/analytics');\n\nconst aaInstance = aa.init({\n  index: 'INDEX_NAME',\n  credentials: 'AUTH_CREDENTIALS',\n  url: 'CLUSTER_URL',\n  userID: 'USER_ID',\n  globalCustomEvents: 'GLOBAL_CUSTOM_EVENTS'\n  headers?: 'CUSTOM_HEADERS'\n});\n```\n\nOptional configuration options:\n\n| Option               | Type                | Description                                                                                                                                                                                                                          |\n| -------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| **`index`**          | `string` (required) | Elasticsearch index name.                                                                                                                                                                                                            |\n| **`credentials`**    | `string` (required) | credentials as they appear on the Appbaseio dashboard. It should be a string of the format \u003cb\u003eusername:password\u003c/b\u003e and is used for authenticating the app.                                                                          |\n| **`url`**            | `string` (required) | Appbaseio cluster URL.                                                                                                                                                                                                               |\n| `userID`             | `string`            | UserID allows you to record events for a particular user. For example, you may want to know that how many different users are using the search.                                                                                      |\n| `globalCustomEvents` | `Object`            | It allows you to set the \u003cb\u003eglobal\u003c/b\u003e custom events which can be used to build your own analytics on top of the appbase.io analytics. [Read More](https://docs.appbase.io/docs/analytics/Implement/#how-to-implement-custom-events) |\n| `headers`            | `Object`            | Sometimes it may require to set extra headers to the analytics API. For example, you're using proxy middleware which adds an additional security layer.                                                                              |\n\nAn example with all possible options:\n\n```ts\nconst aa = require('@appbaseio/analytics');\n\nconst aaInstance = aa.init({\n  index: 'books',\n  credentials: 'foo:bar',\n  url: 'http://localhost:8000',\n  userID: 'jon@abc.com',\n  globalCustomEvents: {\n    platform: 'mac'\n  },\n  headers: {\n    'X-auth-token': 'XYZ'\n  }\n});\n```\n\n### Instance Methods\n\n#### Record Search\n\n```ts\n\nsearch(searchConfig: Object, callback: Function)\n\n```\n\nsearch configuration options:\n\n| Option         | Type     | Description                                                                            |\n| -------------- | -------- | -------------------------------------------------------------------------------------- |\n| **`query`**    | `string` | Search query, set to empty string to register as an empty query search.                |\n| **`queryID`**  | `string` | Search query ID returned from Appbase.                                                 |\n| `customEvents` | `Object` | To set the custom events, for e.g `{ \"platform\": mac }`                                |\n| `filters`      | `Object` | It allows to record the applied facets on the search query, for e.g `{ \"year\": 2018 }` |\n| `hits`         | `Array`  | To set the search hits, a hit object can have the `id`, `type` \u0026 `source` properties . |\n| `impressions`  | `Array`  | To set the impressions, a hit object can have the `id` \u0026 `index` properties.           |\n\n\u003cb\u003eNote: \u003c/b\u003e\n\n`query` or `queryID` must be present.\n\nAn example with all possible options:\n\n```ts\nsearch(\n  {\n    query: 'iphone',\n    // or\n    queryID: 'cf827a07-60a6-43ef-ab93-e1f8e1e3e1a8',\n    customEvents: {\n      source: 'promoted_results'\n    },\n    filters: {\n      year: 2019\n    },\n    hits: [\n      {\n        id: '12345678',\n        source: {\n          title: 'iphoneX'\n        },\n        type: '_doc'\n      }\n    ]\n  },\n  (err, res) =\u003e {\n    if (err) {\n      // handle error\n    } else if (res) {\n      // handle response\n    }\n  }\n);\n```\n\n#### Get queryID\n\nThe below method returns the `queryID` from the last search made.\n\n```ts\ngetQueryID(): string\n```\n\n#### Record Click\n\nTo record a click event\n\n```ts\nclick(clickConfig: Object, callback: Function)\n```\n\nclick configuration options:\n\n| Option              | Type                                 | Description                                                                                   |\n| ------------------- | ------------------------------------ | --------------------------------------------------------------------------------------------- |\n| **`query`**         | `string`                             | Search query, set to empty string to register as an empty query search.                       |\n| **`queryID`**       | `string`                             | Search query ID returned from Appbase.                                                        |\n| **`objects`**       | `{[key: string]: number}` (required) | To set the click object ids followed by click positions, for example `{ \"iphoneX_1234\": 2 }`. |\n| `isSuggestionClick` | `boolean`                            | Set as `true` to register as a suggestion click.                                              |\n| `customEvents`      | `Object`                             | To set the custom events, for e.g `{ \"platform\": mac }`                                       |\n| **`meta`**          | `Object`                             | Meta data                                                                                     |\n\n\u003cb\u003eNote: \u003c/b\u003e\n\n`query` or `queryID` must be present.\n\nAn example with all possible options:\n\n```ts\nclick(\n  {\n    query: 'iphone',\n    // or\n    queryID: 'cf827a07-60a6-43ef-ab93-e1f8e1e3e1a8',\n    customEvents: {\n      source: 'promoted_results'\n    },\n    objects: {\n      iphone_1234: 2\n    },\n    isSuggestionClick: true,\n    meta: {\n      key1: value1\n    }\n  },\n  (err, res) =\u003e {\n    if (err) {\n      // handle error\n    } else if (res) {\n      // handle response\n    }\n  }\n);\n```\n\n#### Record conversion\n\nTo record a conversion event\n\n```ts\nconversion(conversionConfig: Object, callback: Function)\n```\n\nconversion configuration options:\n\n| Option        | Type                       | Description                                                       |\n| ------------- | -------------------------- | ----------------------------------------------------------------- |\n| **`queryID`** | `string` (required)        | Search query ID returned from Appbase.                            |\n| **`objects`** | `Array\u003cstring\u003e` (required) | To set the converted object ids, for example: `[\"iphoneX_1234\"]`. |\n| **`meta`**    | `Object`                   | Meta data                                                         |\n\n\u003cb\u003eNote: \u003c/b\u003e\n\n`queryID` must be present.\n\nAn example with all possible options:\n\n```ts\nconversion(\n  {\n    queryID: 'cf827a07-60a6-43ef-ab93-e1f8e1e3e1a8',\n    objects: ['iphone_1234'],\n    meta: {\n      key1: value1\n    }\n  },\n  (err, res) =\u003e {\n    if (err) {\n      // handle error\n    } else if (res) {\n      // handle response\n    }\n  }\n);\n```\n\n#### Save search\n\nTo save search state\n\n```ts\nsaveSearch(config: Object, callback: Function)\n```\n\nconfiguration options:\n\n| Option               | Type                | Description                                             |\n| -------------------- | ------------------- | ------------------------------------------------------- |\n| **`queryID`**        | `string` (required) | Search query ID returned from Appbase.                  |\n| **`saveSearchID`**   | `string`            | Saved search ID.                                        |\n| **`saveSearchMeta`** | `Object`            | Meta data                                               |\n| **`userID`**         | `string`            | User Id.                                                |\n| `customEvents`       | `Object`            | To set the custom events, for e.g `{ \"platform\": mac }` |\n\n\u003cb\u003eNote: \u003c/b\u003e\n\n`queryID` must be present.\n\nAn example with all possible options:\n\n```ts\nsaveSearch(\n  {\n    queryID: 'cf600405-d4ed-42b0-8b09-08b594fa88d2',\n    saveSearchID: 'analytics-js-test',\n    saveSearchMeta: {\n      key1: 'value1'\n    },\n    userID: 'john@appbase.io',\n    customEvents: { platform: 'mac' }\n  },\n  (err, res) =\u003e {\n    if (err) {\n      // handle error\n    } else if (res) {\n      // handle response\n    }\n  }\n);\n```\n\n#### Delete Saved search\n\nTo delete search state by Id\n\n```ts\ndeleteSavedSearch(savedSearchId: string, callback: Function)\n```\n\nAn example with all possible options:\n\n```ts\ndeleteSavedSearch('analytics-js-test', (err, res) =\u003e {\n  if (err) {\n    // handle error\n  } else if (res) {\n    // handle response\n  }\n});\n```\n\n#### Get saved searches\n\nTo retrieve saved searches\n\n```ts\ngetSavedSearches(queryParams: Object, callback: Function)\n```\n\nYou can find the available query params at [here](https://api.reactivesearch.io/#3cbe91d1-64b9-4e2e-a929-0ee7e6a1acfc).\n\n```ts\ngetSavedSearches(\n  {\n    user_id: 'john@appbase.io'\n  },\n  (err, res) =\u003e {\n    if (err) {\n      // handle error\n    } else if (res) {\n      res\n        .json()\n        .then(favorites =\u003e {\n          // list of saved searches\n        })\n        .catch(err =\u003e {});\n      // handle response\n    }\n  }\n);\n```\n\n#### Favorite\n\nTo record a favorite document\n\n```ts\nfavorite(config: Object, callback: Function)\n```\n\nconfiguration options:\n\n| Option           | Type                | Description                                             |\n| ---------------- | ------------------- | ------------------------------------------------------- |\n| **`queryID`**    | `string` (required) | Search query ID returned from Appbase.                  |\n| **`favoriteOn`** | `string` (required) | Favorite document ID.                                   |\n| **`source`**     | `Object` (required) | Favorite document source object data                    |\n| **`id`**         | `string`            | Favorite ID.                                            |\n| **`meta`**       | `Object`            | Meta data                                               |\n| **`userID`**     | `string`            | User Id.                                                |\n| `customEvents`   | `Object`            | To set the custom events, for e.g `{ \"platform\": mac }` |\n\n\u003cb\u003eNote: \u003c/b\u003e\n\n`queryID`, `favoriteOn` and `source` must be present.\n\nAn example with all possible options:\n\n```ts\nfavorite(\n  {\n    favoriteOn: '1jftXXEBdEU4aeo6Gdqs',\n    queryID: 'cf600405-d4ed-42b0-8b09-08b594fa88d2',\n    source: {\n      authors: 'John Milton, John Leonard',\n      average_rating: 3.8,\n      average_rating_rounded: 4,\n      books_count: 819,\n      id: 984,\n      image: 'https://images.gr-assets.com/books/1455618673l/15997.jpg',\n      image_medium: 'https://images.gr-assets.com/books/1455618673m/15997.jpg',\n      isbn: '140424393',\n      language_code: 'eng',\n      original_publication_year: 1667,\n      original_series: '',\n      original_title: 'Paradise Lost',\n      ratings_count: 96316,\n      title: 'Paradise Lost'\n    },\n    id: 'analytics-js-test',\n    userID: 'john@appbase.io',\n    customEvents: { platform: 'mac' },\n    meta: {\n      key1: 'value1'\n    }\n  },\n  (err, res) =\u003e {\n    if (err) {\n      // handle error\n    } else if (res) {\n      // handle response\n    }\n  }\n);\n```\n\n#### Get favorites\n\nTo retrieve saved favorites\n\n```ts\ngetFavorites(queryParams: Object, callback: Function)\n```\n\nYou can find the available query params at [here](https://api.reactivesearch.io/#11eda024-6b87-4921-8ed1-916483239087).\n\n```ts\ngetFavorites(\n  {\n    user_id: 'john@appbase.io'\n  },\n  (err, res) =\u003e {\n    if (err) {\n      // handle error\n    } else if (res) {\n      res\n        .json()\n        .then(favorites =\u003e {\n          // list of favorites\n        })\n        .catch(err =\u003e {});\n      // handle response\n    }\n  }\n);\n```\n\n#### Set headers\n\nIt allows you to set the custom headers in analytics endpoints.\n\n```ts\nsetHeaders(headers: Object)\n```\n\n#### Set user\n\nSets the user ID. User ID helps to record an event for that particular user.\n\n```ts\nsetUserID(userID: string)\n```\n\n#### Set global events\n\nSets the global event data. This will be added to all the analytics requests made by the instance.\n\n```ts\nsetGlobalCustomEvents(globalEvents: Object)\n```\n\n##\n\n[⬆ Back to Top](#appbase-analytics)\n\n## Contributing\n\nFork the repo and run the following command to run \u0026 test locally.\n\n```bash\nyarn \u0026\u0026 yarn test\n```\n\n## Other Projects You Might Like\n\n- [**Arc**](https://github.com/appbaseio/arc) API Gateway for ElasticSearch (Out of the box Security, Rate Limit Features, Record Analytics and Request Logs).\n\n- [**ReactiveSearch**](https://github.com/appbaseio/reactivesearch) ReactiveSearch is an Elasticsearch UI components library for React, React Native and Vue. It has 25+ components consisting of Lists, Ranges, Search UIs, Result displays and a way to bring any existing UI component into the library.\n\n- **searchbox** A lightweight and performance-focused search box UI libraries to query and display results from your ElasticSearch app (aka index).\n\n  - [**Vanilla**](https://github.com/appbaseio/searchbox) - (~16kB Minified + Gzipped)\n  - [**React**](https://github.com/appbaseio/react-searchbox) - (~30kB Minified + Gzipped)\n  - [**Vue**](https://github.com/appbaseio/vue-searchbox) - (~22kB Minified + Gzipped)\n\n- [**Dejavu**](https://github.com/appbaseio/dejavu) allows viewing raw data within an appbase.io (or Elasticsearch) app. **Soon to be released feature:** An ability to import custom data from CSV and JSON files, along with a guided walkthrough on applying data mappings.\n\n- [**Mirage**](https://github.com/appbaseio/mirage) ReactiveSearch components can be extended using custom Elasticsearch queries. For those new to Elasticsearch, Mirage provides an intuitive GUI for composing queries.\n\n- [**ReactiveMaps**](https://github.com/appbaseio/reactivesearch/tree/next/packages/maps) is a similar project to Reactive Search that allows building realtime maps easily.\n\n- [**appbase-js**](https://github.com/appbaseio/appbase-js) While building search UIs is dandy with Reactive Search, you might also need to add some input forms. **appbase-js** comes in handy there.\n\n## License\n\nThis library is [Apache licensed](LICENSE.md).\n\n[⬆ Back to Top](#appbase-analytics)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappbaseio%2Fanalytics.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappbaseio%2Fanalytics.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappbaseio%2Fanalytics.js/lists"}