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

# Using NPM

> How to use Koala's npm packages for instrumentation

## Instrumenting with NPM Packages

You can choose to instrument your website using our npm packages when instrumenting Koala directly via script tag is not a possibility.

### When to use one of the Koala NPM packages?

* If you want to pin versions of the Koala SDK and not rely on the dynamically generated ones from our CDN
* When you want to add typescript types for Koala in your project
* You want to use React hooks in your Koala tracking
* When you want a tighter integration with your build or type system

### Using the generic Browser package

We ship new versions of our SDK to NPM on every release, all releases of the Koala SDK will be available on the `@getkoala/browser` package on NPM.
The browser package includes the most recent bundled version of our SDK.

1. Install the npm package

```bash theme={null}
$ yarn add @getkoala/browser
```

2. Load the Koala SDK

```javascript theme={null}
import * as KoalaSDK from '@getkoala/browser'
```

3. Load your project

```javascript theme={null}
// returns a promise containing the ko namespace object
let ko = null

KoalaSDK.load({
  // add your project's public key here
  project: 'pk_...'
}).then(koalaSDK => {
  ko = koalaSDK
})
```

4. Use the Koala SDK
   Once you've loaded your project, you should be able to use all methods from the Koala SDK normally on your website

```javascript theme={null}
ko.track('Hello from Koala!', eventProperties)
ko.identify({
  email: 'netto@getkoala.com',
  ...userTraits
})
```

<Note>
  We recommend using our inline script tag whenever possible, so you can leverage our fast CDN times and the latest updates, features, and bug fixes whenever they're available.
</Note>

### Using the React package

Koala also works with Typescript and React. You can install the `@getkoala/react` package to start using Koala directly in your React app.

You can find more in-depth and up to date guides on our [getkoala/react](https://github.com/getkoala/react) github repo.
