# Source: https://docs.unifygtm.com/developers/intent-client/js-client.md

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

# JavaScript Client

> 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" />

  <Card title="npm" icon="npm" iconType="solid" color="#BD0005" href="https://www.npmjs.com/package/@unifygtm/intent-client" />
</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
  ```
</CodeGroup>

## Usage

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

<Warning>You should only initialize the client one time in your application.</Warning>

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

const writeKey = 'YOUR_PUBLIC_API_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();
```

You can then use the resulting client instance to log intent data. See the
[Client Spec](./client-spec) for more details on how to use the client.

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