> ## 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.

<CardGroup cols={2}>
  <Card title="Github" icon="github" iconType="solid" href="https://github.com/unifygtm/intent-js-client" horizontal />

  <Card title="npm" icon="npm" iconType="solid" color="#BD0005" href="https://www.npmjs.com/package/@unifygtm/intent-client" horizontal />
</CardGroup>

## Installation

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

<CodeGroup>
  ```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
  ```
</CodeGroup>

## 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.
</Warning>

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

## 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();
```
