> For the complete documentation index, see [llms.txt](https://docs.screendesk.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.screendesk.io/request-screen-recording/developer-tools/installing-screendesk-script.md). Agents can also search and read this documentation through its [MCP server](https://docs.screendesk.io/~gitbook/mcp).

# Install the snippet

Add the Screendesk snippet to your website, then check that it loads.

The snippet brings your website's console logs, network requests and blur into recordings. You'll find it in **Settings → Logs & blur → Logs**, with your workspace's account key already filled in.

{% embed url="<https://app.screendesk.io/recordings/1493da99-8562-4330-b684-1330b97bbeca>" %}

Available on every plan, with no limit on the number of websites.

<figure><img src="https://3820804400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfW6XSzJSKsNyZnOkSJPt%2Fuploads%2F0FOU7dVU0keSg64A7isV%2Fdocs-panel-logs.png?alt=media" alt="Settings, Logs &#x26; blur, Logs tab, with the snippet"><figcaption></figcaption></figure>

{% stepper %}
{% step %}

### Add the snippet to your site

Under **Install the snippet**, pick how your site is built and copy the code.

{% tabs %}
{% tab title="HTML" %}
Paste it first in the `<head>` of every page, without `async` or `defer`.

```html
<meta name="screendesk-account" content="YOUR_ACCOUNT_KEY">
<script type="module" src="https://app.screendesk.io/sdk/record.js"></script>
<script type="module" src="https://app.screendesk.io/sdk/logs.js"></script>
```

{% endtab %}

{% tab title="Next.js" %}
Put it in the root layout, not in a nested route's layout. With the Pages Router, put the same three tags inside `<Head>` in `pages/_document.tsx`.

```tsx
// app/layout.tsx
export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <head>
        <meta name="screendesk-account" content="YOUR_ACCOUNT_KEY" />
        <script type="module" src="https://app.screendesk.io/sdk/record.js"></script>
        <script type="module" src="https://app.screendesk.io/sdk/logs.js"></script>
      </head>
      <body>{children}</body>
    </html>
  );
}
```

{% endtab %}

{% tab title="Tag Manager" %}
Add the HTML snippet as a **Custom HTML** tag that fires on **All Pages**. Errors thrown before the tag runs aren't captured.
{% endtab %}

{% tab title="npm" %}
For apps that bundle their dependencies. The package adds the meta tag and loads the two scripts from Screendesk.

```bash
npm install @screendesk/recording
```

```javascript
// once, as the app starts, on every page
import { initialize } from "@screendesk/recording";

initialize({ account: "YOUR_ACCOUNT_KEY" });
```

{% endtab %}
{% endtabs %}

Someone else installs it? Click **Email them the instructions**, or **Copy agent prompt** to give the steps to a coding assistant.
{% endstep %}

{% step %}

### Add your website

Under **Add your website**, enter the address your customers use, for example `app.example.com`, and click **Add website**.
{% endstep %}

{% step %}

### Run the test

On the website's row, click **Run test**. Your page opens in a new tab: keep it open. When the snippet loads, the badge changes from **Waiting for the snippet** to **Verified**.
{% endstep %}
{% endstepper %}

## If the test fails

* **Content-Security-Policy**: allow `https://app.screendesk.io` in `script-src`, `frame-src` and `connect-src`. Run `screendesk.status()` in your page's console to see what was blocked.
* **Redirects**: the page must keep its address as opened. If it redirects to a sign-in page or from `/` to `/home`, open the website's menu, click **Edit** and set a **Landing path** that loads directly.
* **Import map**: if the page has a `<script type="importmap">`, put the snippet right after it. Firefox ignores an import map that comes after a module script.
* **XHTML pages** (`application/xhtml+xml`): use the two script tags with `defer` in place of `type="module"`.

## Good to know

* In Safari, logs are only captured on tabs on the exact subdomain where the recording started, and Private Windows aren't supported.
* Recording links share the screen from your page. A `Permissions-Policy` header must allow `display-capture`, and a page shown inside an iframe needs `allow="display-capture; microphone"` on that iframe.
* With more than one website, **Make default** in a website's menu picks where request links open. **Edit** also picks which help desks record on it by default.
* To change the English texts your pages show while recording, call `screendesk.texts({ … })` after the snippet. The **Recorder texts** section lists the keys.

## Embed snippet

While the Logs tab says **Recording on websites isn't on for this workspace yet**, request links open the recorder on Screendesk. The **Embed snippet** section at the bottom of the tab then brings your logs and blur: while a customer records, it sends the console logs of their open tabs on your site and blurs its sensitive fields.

1. Copy the snippet and add it before the closing `</body>` tag, once per page.

   ```html
   <!-- Screendesk Embed -->
   <script>(function(){
     var d = document;
     var s = d.createElement("script");
     s.src = "https://app.screendesk.io/widget/YOUR_EMBED_ID";
     s.async = 1;
     d.getElementsByTagName("head")[0].appendChild(s);
   })();</script>
   ```
2. Click **Check a page**, paste a live page that opens without signing in, then click **Check page**.

If your site sets a Content-Security-Policy, allow `https://app.screendesk.io` in `script-src` and `connect-src`, and `wss://socket.screendesk.io` in `connect-src`. The snippet is an inline script, so `script-src` also needs `'unsafe-inline'` or a nonce on the tag.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.screendesk.io/request-screen-recording/developer-tools/installing-screendesk-script.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
