--- title: CrazyEgg description: Using the CrazyEgg plugin --- Integration with [crazy egg](https://www.crazyegg.com/) for [analytics](https://www.npmjs.com/package/analytics) Crazy Egg adds heat mapping, A/B testing, and session recording functionality to websites and applications. This allows developers, marketers, and product owners to see what is working and what areas of an application might need improvements. This analytics plugin will load Crazy Egg into your application.
Click to expand - [Installation](#installation) - [How to use](#how-to-use) - [Platforms Supported](#platforms-supported) - [Browser usage](#browser-usage) - [Browser API](#browser-api) - [Configuration options for browser](#configuration-options-for-browser) - [Additional examples](#additional-examples) - [Usage](#usage)
## Installation Install `analytics` and `@analytics/crazy-egg` packages ```bash npm install analytics npm install @analytics/crazy-egg ``` ## How to use The `@analytics/crazy-egg` package works in [the browser](#browser-usage). To use, install the package, include in your project and initialize the plugin with [analytics](https://www.npmjs.com/package/analytics). Below is an example of how to use the browser plugin. ```js import Analytics from 'analytics' import crazyEgg from '@analytics/crazy-egg' const analytics = Analytics({ app: 'awesome-app', plugins: [ // This will load crazy egg on to the page crazyEgg({ accountNumber: '1234578' }) ] }) ``` See [additional implementation examples](#additional-examples) for more details on using in your project. ## Platforms Supported The `@analytics/crazy-egg` package works in [the browser](#browser-usage) ## Browser usage See below from browser API ### Browser API ```js import Analytics from 'analytics' import crazyEgg from '@analytics/crazy-egg' const analytics = Analytics({ app: 'awesome-app', plugins: [ // This will load crazy egg on to the page crazyEgg({ accountNumber: '1234578' }) ] }) ``` ### Configuration options for browser | Option | description | |:---------------------------|:-----------| | `accountNumber`
**required** - string| crazy egg account ID | ## Additional examples Below are additional implementation examples.
Using in HTML Below is an example of importing via the unpkg CDN. Please note this will pull in the latest version of the package. ```html Using @analytics/crazy-egg in HTML .... ```
Using in HTML via ES Modules Using `@analytics/crazy-egg` in ESM modules. ```html Using @analytics/crazy-egg in HTML via ESModules .... ```
## Usage Include `analytics` and `@analytics/crazy-egg` in the source code of your project. Initialize analytics with the crazy-egg plugin and the crazy-egg heat mapping script will be automatically loaded into the page. ```js import Analytics from 'analytics' import crazyEgg from '@analytics/crazy-egg' const analytics = Analytics({ app: 'awesome-app', plugins: [ crazyEgg({ accountNumber: '12345678' }), ] }) // Crazy Egg is now loaded! ``` See the [full list of analytics provider plugins](https://getanalytics.io/plugins/) in the main repo.