# Install JavaScript using NPM Package

To install JavaScript code as an NPM package, follow the instructions below:

1. I**nstall the Package:** Open your terminal or command prompt.

```bash
npm i reodotdev
# or
yarn add reodotdev
```

2. **Integrate the Package into Your Project:** Within your project, identify the file or module where you want to incorporate the user activity tracking.
3. **Use with NPM:** Import the required function from the installed package and set up the script to load the Reo tracking.

#### **For Documentation**

Copy the below JavaScript code snippet&#x20;

```javascript
// Use with NPM
import { loadReoScript } from 'reodotdev'

// Declare clientID from environment variable or directly as string
const clientID = process.env.CLIENT_ID || "XXXXXXXXXX";

// Resolve promise to get access to methods on Reo
const reoPromise = loadReoScript({ clientID });
reoPromise
  .then(Reo => {
     Reo.init({ clientID });
  })
  .catch(error => {
    console.error('Error loading Reo', error);
  })
```

Replace the Client ID XXXXXXXX in the above code with the client code in Integrations > Input Sources > Documentation&#x20;

<figure><img src="https://2705882080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fx46P5sAHxDG7PqOdVLxI%2Fuploads%2FgaHcWzOLbqIJgfYMsHwP%2Fimage.png?alt=media&#x26;token=6e433ab0-3c5d-45be-ae08-971ca4323d66" alt=""><figcaption></figcaption></figure>

#### **For Website**

Copy the below JavaScript code snippet&#x20;

```javascript
// Use with NPM
import { loadReoScript } from 'reodotdev'

// Declare clientID from environment variable or directly as string
const clientID = process.env.CLIENT_ID || "XXXXXXXXXX";

// Resolve promise to get access to methods on Reo
const reoPromise = loadReoScript({ clientID });
reoPromise
  .then(Reo => {
     Reo.init({ clientID });
  })
  .catch(error => {
    console.error('Error loading Reo', error);
  })
```

Replace the Client ID XXXXXXXX in the above code with the client code in Integrations > Input Sources > Website

<figure><img src="https://2705882080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fx46P5sAHxDG7PqOdVLxI%2Fuploads%2F5OlOzl1qFM2UOn6wtj67%2Fimage.png?alt=media&#x26;token=91f56f7c-8da7-4a64-a3f8-3bd5097e1d49" alt=""><figcaption></figcaption></figure>

4. **Adjust Environment Variables (if needed)**

   If using environment variables, make sure to set them up in your environment configuration or `.env` files.
5. **Save Changes:**

   Save the file containing the updated code.
6. **Build and Deploy:**

   Compile or bundle your project based on your build process, and deploy the changes to your server or hosting service.
7. **Verification:**
8. Go to any screen after login and right-click anywhere
9. In the dropdown menu, select Inspect.

![](https://usercontent.us.prod.clueso.io/d06f019c-da0b-4d5b-9fdd-9630e7fd5d0f/5de419e7-9710-42aa-a517-a7a730000514/b0420c60-cc46-4268-ba9d-93da376c5372/images/88f2ed4e-be0c-444d-b601-448184f27fe6.png)

10. In the elements tab, Use the  Ctrl + F or Cmd + F  and search for “reo”

![](https://usercontent.us.prod.clueso.io/d06f019c-da0b-4d5b-9fdd-9630e7fd5d0f/5de419e7-9710-42aa-a517-a7a730000514/b0420c60-cc46-4268-ba9d-93da376c5372/images/80b9b81f-48fb-4ca2-a23f-5fc7c6be5bfd.png)

11. If the tracking code appears, verify that the **code matches.**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.reo.dev/install-javascript-using-npm-package.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
