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

# Manual Installation

> Add the CutMeShort Analytics script to any website

Use this option if you have access to your website’s HTML template (or a tag manager) and want to install the CutMeShort Analytics script directly.

## Add the script to your site

Paste the script **once** on every page of your website, ideally inside the `<head>` tag so it can read the landing-page URL before the user navigates.

```html theme={null}
<script
  src="https://cut-me-short-public.s3.ap-south-1.amazonaws.com/production/track.js"
  data-config='{"days":30,"attribution":"last"}'
></script>
```

### Where to place it

* **Static HTML sites**: put it in the shared layout file right before `</head>`.
* **Single-page apps (React/Vue/Next, etc.)**: put it in your app’s document/layout head so it loads on all routes.
* **Tag managers**: create a Custom HTML tag that fires on **All Pages**.

## What the script does

Once installed, the script:

* **Reads attribution from the landing URL**: detects `cms_rf` in the query string (example: `?cms_rf=abc123`).
* **Stores attribution as a first-party cookie**: saves the value for the configured cookie duration (for example, 30 or 90 days), so conversions that happen later can still be attributed.
* **Exposes a global tracking object**: makes the client SDK available under `window._cms` for debugging/verification.
* **Sends events with attribution attached**: when your lead/sale events are fired, the stored `cms_rf` is included so the conversion is credited to the original CutMeShort link click.

## Configuration options

You can pass the following attributes on the script tag:

### `data-config`

|             |                                    |
| ----------- | ---------------------------------- |
| **Type**    | `JSON string`                      |
| **Example** | `{"days":30,"attribution":"last"}` |

Used to configure cookie duration (`days`) and attribution model (`attribution`) for tracking.

Use one of these script configurations:

```html theme={null}
<!-- first-click, 90-day cookie -->
<script src="https://cut-me-short-public.s3.ap-south-1.amazonaws.com/production/track.js" data-config='{"days":90,"attribution":"first"}'></script>

<!-- last-click, 30-day cookie -->
<script src="https://cut-me-short-public.s3.ap-south-1.amazonaws.com/production/track.js" data-config='{"days":30,"attribution":"last"}'></script>
```

## Verification

1. Open your website, then open the browser console and run:
   * `window._cms`
2. Visit a test landing page URL that includes `cms_rf`, for example:
   * `https://your-site.com/?cms_rf=test`
3. Confirm a first‑party cookie is set (in your browser devtools under **Application → Cookies**).

If the checks fail, make sure:

* The script is present in the `<head>` and not duplicated.
* Your site (or CDN) is not serving a cached version of the page missing the script.

## Next steps

After the script is installed, you can send **Lead** and **Sale** conversions from your backend (recommended) using the Attribution endpoints.
