> ## Documentation Index
> Fetch the complete documentation index at: https://docs.unifygtm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Install JavaScript package

> Install the Unify Intent client in a frontend web application framework.

> [card] [Github](https://github.com/unifygtm/intent-js-client)

> [card] [npm](https://www.npmjs.com/package/@unifygtm/intent-client)

## Installation

You can install the Unify Intent JS Client with your preferred package manager:

```shell npm theme={null}
npm install @unifygtm/intent-client
```

```shell yarn theme={null}
yarn add @unifygtm/intent-client
```

```shell pnpm theme={null}
pnpm add @unifygtm/intent-client
```

```shell bun theme={null}
bun add @unifygtm/intent-client
```

## Usage

After installing the client, you must initialize it in your application code:

```ts index.ts theme={null}
import { UnifyIntentClient, UnifyIntentClientConfig } from '@unifygtm/intent-client';

const writeKey = 'YOUR_PUBLIC_WRITE_KEY';

const config: UnifyIntentClientConfig = {
  autoPage: true,
  autoIdentify: false,
};

const unify = new UnifyIntentClient(writeKey, config);

// Do not call mount during server side rendering. Only call it in a browser context.
unify.mount();
```

> [!WARNING]
>
> Be sure to only initialize the client one time in your application.

For details on how to use the client to send events, see the full [Usage guide](https://docs.unifygtm.com/developers/intent-client/usage-guide.md).

## Cleanup

When you are done using the client, if you wish to clean up the side effects
generated by it, you can do so with the `unmount` method:

```ts cleanup.ts theme={null}
import { UnifyIntentClient, UnifyIntentClientConfig } from '@unifygtm/intent-client';

const writeKey = 'YOUR_PUBLIC_API_KEY';

const unify = new UnifyIntentClient(writeKey);
unify.mount();

// Use the client for some time, then later...

unify.unmount();
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.