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

# Website Tracker

> Track visitor behavior and identify users on your website

## Overview

The CustomerOS website tracker allows you to monitor visitor behavior and identify users across your website. Once installed, it automatically tracks page views and custom events, providing valuable insights into how visitors interact with your site.

## Installation

To install the CustomerOS tracker, follow the instructions in the app with your specific reverse-proxied domain. Choose between the HTML script or JavaScript snippet depending on the application you are using.

## Identifying Users

Once the tracker script is loaded, you can identify users and attach custom properties to their profile using the `identify` function.

### Basic Usage

```javascript theme={"system"}
window.cos.identify({
    email: "user@example.com",
    name: "John Doe",
});
```

### When to Use Identify

Call the `identify` function at key moments in your user journey:

* **After user login**: Identify the user with their profile information
* **After signup**: Capture new user details
* **On profile updates**: Update user properties when they change
* **On page load (for authenticated users)**: Ensure returning users are identified

### Example: Identify on Login

```javascript theme={"system"}
// After successful login
async function handleLogin(email, password) {
    const user = await loginUser(email, password);

    // Identify the user in CustomerOS
    window.cos.identify({
        email: user.email,
        name: user.name,
        user_id: user.id,
        plan: user.subscription.plan,
    });
}
```

### Disabling Automatic Event Tracking

By default, the tracker automatically captures page views and events. If you want to disable automatic event tracking and only track events manually, set the `c.__disableCosEvents__` parameter to `true`.

This is especially helpful for preventing unwanted collection of data within applications where PII and other data may be sent and received.

<CodeGroup>
  ```html HTML Script {12} theme={"system"}
  <script id="customeros-metrics" type="text/javascript">
      (function (c, u, s, t, o, m, e, r, O, S) {
          var customerOS = document.createElement(s);
          customerOS.src = u;
          customerOS.async = true;
          c.__disableCosEvents__ = t;
          (document.body || document.head).appendChild(customerOS);
      })(
          window,
          "https://reverse-proxy.example.com/analytics-0.1.js",
          "script",
          true
      );
  </script>
  ```

  ```javascript JavaScript {15} theme={"system"}
  (function () {
      const SRC = "https://reverse-proxy.example.com/analytics-0.1.js";
      const ID = "customeros-metrics-loader";

      function inject() {
          if (
              !document.getElementById(ID) &&
              !document.querySelector('script[src="' + SRC + "']")
          ) {
              const s = document.createElement("script");

              s.id = ID;
              s.async = true;
              s.src = SRC;
              window.__disableCosEvents__ = true;
              (document.head || document.body).appendChild(s);
          }
      }

      document.readyState === "loading"
          ? document.addEventListener("DOMContentLoaded", inject)
          : inject();
  })();
  ```
</CodeGroup>

## Platform-Specific Guides

For specific implementation instructions for your platform, see the guides below:

<CardGroup cols={2}>
  <Card title="Webflow" icon="webflow" href="/tracker/webflow">
    Install on Webflow sites
  </Card>

  <Card title="Framer" icon="window" href="/tracker/framer">
    Install on Framer sites
  </Card>

  <Card title="Mintlify" icon="mintbit" href="/tracker/mintlify">
    Install on Mintlify docs
  </Card>

  <Card title="Google Tag Manager" icon="google" href="/tracker/google-tag-manager">
    Install via Google Tag Manager
  </Card>

  <Card title="GitBook" icon="book-open" href="/tracker/gitbook">
    Install on GitBook docs
  </Card>

  <Card title="Docusaurus" icon="t-rex" href="/tracker/docusaurus">
    Install on Docusaurus sites
  </Card>

  <Card title="Fern" icon="leaf" href="/tracker/fern">
    Install on Fern docs
  </Card>

  <Card title="Scalar" icon="wave-square" href="/tracker/scalar">
    Install on Scalar API docs
  </Card>
</CardGroup>

## Troubleshooting

Having issues with the tracker? Check out our [troubleshooting guide](/tracker/troubleshooting) for common solutions.
