# Script Monitoring docs (full text) Every page of https://docs.scriptmonitoring.com in reading order. # Script Monitoring documentation > Install the Script Monitoring tag, triage alerts, approve or block vendors, and collect PCI DSS 6.4.3 and 11.6.1 evidence. Guides and reference. Source: https://docs.scriptmonitoring.com/ · Plan: All plans · Updated 2026-10-13 Script Monitoring watches every third-party script that runs on your pages. You add one script tag to the `` of your site, and from then on each script your visitors load is inventoried, grouped by the vendor that serves it, and checked against a catalog of detection rules. When a rule fires you get an alert with a risk score from 1 to 10, and you decide once per vendor: allow it, block the flagged scripts, or look again later. The same data is your evidence for PCI DSS 4.0.1: a script inventory with a justification for each vendor (requirement 6.4.3), the security headers on your payment pages watched for changes (requirement 11.6.1), and a weekly evidence pack. These docs show you how to set it up and use it. For how it works under the hood, see [How it works](https://www.scriptmonitoring.com/platform/architecture/). ## Where do I start? - [Quickstart](https://docs.scriptmonitoring.com/quickstart/): From install to a clean alert queue, step by step. - [Verify it's working](https://docs.scriptmonitoring.com/verify/): Confirm the tag is delivered and reporting. - [Payment pages](https://docs.scriptmonitoring.com/payment-pages/): Name the pages that take payment, for PCI DSS. - [Respond to a malicious script](https://docs.scriptmonitoring.com/guides/malicious-script/): Block it, check where it ran, remove the source. ## Frequently asked questions ### Which plans do these docs cover? All of them. Each page shows the lowest plan that includes the feature it describes. Plans and prices are on the [pricing page](https://www.scriptmonitoring.com/pricing/). ### Is there a version of these docs for AI assistants? Yes. Every page has a clean Markdown version: add `.md` to its URL, or use **View as Markdown** under the title. [llms.txt](https://docs.scriptmonitoring.com/llms.txt) lists every page and [llms-full.txt](https://docs.scriptmonitoring.com/llms-full.txt) has the full text in one file. ### Where do I ask a question the docs don't answer? Use the chat on this site or in the [dashboard](https://app.scriptmonitoring.com). --- # Quickstart > The shortest path to a working install: answer Setup steps 1 and 2, add the tag from step 3, load a page and confirm it reports in step 5. Source: https://docs.scriptmonitoring.com/quickstart/ · Plan: All plans · Updated 2026-10-13 The quickest way to start is four steps in **Developers > Setup**: pick your use case, pick your site type, add the tag, and verify. Once step 5 says the tag is live, Script Monitoring is watching every third-party script on your pages. ![The Setup page for the Payments platform team: a five-step stepper (Use case, Site type, Install, Scope, Verify) with step 1 asking what you are monitoring for.](https://docs.scriptmonitoring.com/screenshots/setup-overview-light.webp) ## Step 1: open Setup [Sign up or log in](https://app.scriptmonitoring.com). New accounts land on **Developers > Setup**. ## Step 2: answer the use case and site type Pick **Client-side security**, **PCI DSS 6.4.3 & 11.6.1** or **Both** in step 1, and whether your site is a single-page app in step 2. They change what the install step recommends, and you can change them later. What each use case reports: [Payment pages](https://docs.scriptmonitoring.com/payment-pages/#which-use-case-should-i-choose). ## Step 3: add the tag Copy the snippet for your method from step 3 and put it first in the `` of every page: [Install the script tag](https://docs.scriptmonitoring.com/install/). ## Step 4: verify Load a page on your site and open step 5. It says **Live** once reports arrive: [Verify it's working](https://docs.scriptmonitoring.com/verify/). ## What's next? [Next: Your first week →](https://docs.scriptmonitoring.com/guides/first-week/) ## Frequently asked questions ### How long does this take? As long as it takes to deploy one line to your site. The first report arrives within a minute of a page being visited. ### Which install method should I pick? The one that matches who owns your HTML: see [Install the script tag](https://docs.scriptmonitoring.com/install/). ## Related - [Your first week](https://docs.scriptmonitoring.com/guides/first-week/) - [Install the script tag](https://docs.scriptmonitoring.com/install/) - [Verify it's working](https://docs.scriptmonitoring.com/verify/) --- # Install the script tag > Add the Script Monitoring tag to your site. Copy your snippet from Setup step 3, pick a method and place the tag first in the head. Source: https://docs.scriptmonitoring.com/install/ · Plan: All plans · Updated 2026-10-13 You install Script Monitoring by adding one script tag to the `` of your site. The tag is the same for every page and every domain in a team, and the dashboard builds it for you: open **Developers > Setup**, go to step 3, **Install**, and copy the snippet for the method that fits your stack. ## Which method should I use? Every method produces the same tag in the same place. Pick the one that matches who owns your HTML. - [HTML](https://docs.scriptmonitoring.com/install/html/): You edit the HTML or index.html yourself. The default and the most direct. - [Google Tag Manager](https://docs.scriptmonitoring.com/install/google-tag-manager/): A Custom HTML tag. For testing only, because GTM does not guarantee load order. - [Next.js](https://docs.scriptmonitoring.com/install/nextjs/): The @scriptmonitoring/next component, for the Pages Router or the App Router. - [Vite](https://docs.scriptmonitoring.com/install/vite/): The @scriptmonitoring/vite plugin injects the tag into every build. - [CLI](https://docs.scriptmonitoring.com/install/cli/): @scriptmonitoring/cli injects the tag into static HTML after your build step. - [AI assistant](https://docs.scriptmonitoring.com/install/ai-assistant/): One prompt for Claude Code, Cursor or Copilot, with your script URL in it. > Install with AI: paste this prompt into your coding assistant: "Fetch the Script Monitoring installation guide from https://docs.scriptmonitoring.com/ai-setup.md and follow the instructions to add Script Monitoring client-side security monitoring to this project." ## How do I find my snippet? 1. In the dashboard, open **Developers > Setup**. New accounts land here after sign-up. 2. Answer step 1, **Use case**, and step 2, **Site type**. They are asked first because they change what the install step recommends, for example on a single-page app. 3. Go to step 3, **Install**, and pick a method tile: **HTML**, **GTM**, **AI**, **NextJS**, **Vite** or **CLI**. 4. Copy the snippet with its copy button. The step header shows your **Script URL**. ![The install step showing the script tag for the Payments platform team and the install method tabs: HTML, GTM, AI, NextJS, Vite and CLI.](https://docs.scriptmonitoring.com/screenshots/setup-install-snippet-light.webp) ## What goes into the snippet? Every snippet points at your team's script URL: ```text https://.cdn.scriptmt.com/sm.js ``` `` is your team's ID, a 14-digit number starting with 1: for example `https://14827391650423.cdn.scriptmt.com/sm.js`. Example IDs in these docs, such as `14827391650423`, are reserved for documentation: no real team ever gets one, and our install tools reject them. Always use your own team ID. The dashboard fills it in, so a snippet copied from Setup is ready to paste. The [CLI](https://docs.scriptmonitoring.com/install/cli/) takes the same ID as `--team-id`. Every method produces the same tag (the plain one is on [HTML](https://docs.scriptmonitoring.com/install/html/)), with two rules: - `referrerpolicy="origin"` sends your site's origin with the request, so the tag knows which domain it runs on. Keep it. - There is no `async` and no `defer`. The tag has to run before the scripts it watches. ## Where on the page does the tag go? At the top of the ``, before any other script, on every page. Scripts that start before the tag are not seen. On a single-page app the rule is the same: the tag goes in the `` of your HTML shell, before the app bundle, and the tag watches route changes instead of page loads. ## Do my domains need to be in the dashboard? Yes. The tag reports from the domains in your team, so each domain it runs on must be listed under **Security > Domains**. Step 5, **Verify**, counts how many of them are reporting. ## What is under Install > Advanced? Step 3 has an **Advanced** section with the team's install settings. Only Super admins and Admins of the team can change them. | Setting | What it does | | --- | --- | | Release channel | Which web script release the tag serves: **Latest** (the default) or **Stable**. | | Page URL query strings | Removes query strings from page URLs before they are stored. Turn it on if your URLs carry secrets, such as password reset tokens or magic links. Script URLs are not affected, and URLs already stored are unchanged. | | Custom request headers | Headers attached to the script's requests, so you can identify and filter them. | Some teams also see **Page monitoring scope**, a list of URL patterns that limits which pages the script monitors. With no patterns, every page is monitored. ## What comes after the install? Set your [payment pages](https://docs.scriptmonitoring.com/payment-pages/) in step 4 if you need PCI DSS evidence, then [verify the install](https://docs.scriptmonitoring.com/verify/) in step 5. Content Security Policy reports are set up separately, with response headers on your server: see [CSP reporting](https://docs.scriptmonitoring.com/csp-reporting/). ## Frequently asked questions ### Is the snippet different for each domain? No. The script is issued per team, and the team ID is part of its URL, so every domain in the team uses the same tag. CSP reporting is the one setting that is per domain. ### Where do I find my team ID? The dashboard fills it in for you in Setup step 3, which shows it as **Script URL** in the step header. It is also in the **Team ID** chip in the top bar, with a copy button. A team ID is a 14-digit number starting with 1, such as `14827391650423`. ### Can I add async or defer to the tag? No. Keep it a plain, synchronous tag at the top of the ``. Scripts that run before it are not seen. ### Which method should I use for a single-page app? The tag goes in the `` of your HTML shell, before the app bundle. If you edit `index.html` yourself, use [HTML](https://docs.scriptmonitoring.com/install/html/). On Next.js, use [Next.js](https://docs.scriptmonitoring.com/install/nextjs/). To have it enforced in CI, use [Vite](https://docs.scriptmonitoring.com/install/vite/) or the [CLI](https://docs.scriptmonitoring.com/install/cli/). ### Do I need a different tag for staging? No. The tag is per team. If staging is a separate domain, add it to the team so it reports, or put it in a separate team if you want its data kept apart (more than one team needs Pro). ## Related - [Verify it's working](https://docs.scriptmonitoring.com/verify/) - [Payment pages](https://docs.scriptmonitoring.com/payment-pages/) - [CSP reporting](https://docs.scriptmonitoring.com/csp-reporting/) --- # Install with an HTML script tag > Paste the Script Monitoring script tag at the top of your site's head. Copy the snippet from Setup step 3, keep it synchronous, and add it to every page. Source: https://docs.scriptmonitoring.com/install/html/ · Plan: All plans · Updated 2026-10-13 The HTML method is one line: paste the Script Monitoring tag at the top of the `` of every page, before any other script. It works on any site where you control the HTML, including single-page apps whose `index.html` you edit yourself. ![Install with HTML: paste the script tag at the top of every page's head tag.](https://docs.scriptmonitoring.com/screenshots/setup-install-html-light.webp) ## How do I add the tag? 1. In the dashboard, open **Developers > Setup** and go to step 3, **Install**. 2. Pick **HTML**. The panel says: "Copy and paste this code at the top of your website's `` tag." 3. Click **Copy script tag**. It copies just the tag: ```html ``` 4. Paste it as the first element inside `` on every page: ```html ... ... ``` 5. Deploy, load a page on your site, and open step 5, **Verify**. See [Verify it's working](https://docs.scriptmonitoring.com/verify/). `` is filled in for you when you copy from the dashboard. Before you deploy, check the tag against the [placement rules](https://docs.scriptmonitoring.com/install/#where-on-the-page-does-the-tag-go): first in the ``, no `async` or `defer`, `referrerpolicy` kept. Tag managers, consent tools and analytics go below it. **Having trouble seeing reports?** Check the tag against the [placement rules](https://docs.scriptmonitoring.com/install/#where-on-the-page-does-the-tag-go), make sure the domain is listed under **Security > Domains**, then follow [Verify it's working](https://docs.scriptmonitoring.com/verify/). ## What if my team uses an immutable script? Some teams have an immutable script, turned on by Script Monitoring staff. For those teams the HTML method shows the **Immutable script** panel instead of the snippet above: a script URL that never changes, with a Subresource Integrity value. ```html ``` Copy the exact tag from the panel (**Copy script tag**, **Copy URL**, **Copy integrity**) and place it at the top of the ``, synchronous, like the standard tag. Your site keeps the installed version until you replace the tag: configuration changes and script updates are adopted by installing a newly published URL and integrity value. **Refresh** only checks whether a newer version was published. It does not change your site. ## Frequently asked questions ### Do I need to change the tag when Script Monitoring ships a new script version? No. The tag's URL serves the current release of your team's release channel (**Latest** or **Stable**, under Install > Advanced). Only an immutable script keeps the version you installed. ### Can I add it to a shared template instead of every page? Yes. Put it in the layout or template that renders the `` for every page, as the first script. On a single-page app that is the HTML shell, usually `index.html`. ## Related - [Install the script tag](https://docs.scriptmonitoring.com/install/) - [Verify it's working](https://docs.scriptmonitoring.com/verify/) - [Vite](https://docs.scriptmonitoring.com/install/vite/) --- # Install with Google Tag Manager > Add the Script Monitoring tag as a GTM Custom HTML tag on All Pages to test it quickly. For production, install the tag directly in the head. Source: https://docs.scriptmonitoring.com/install/google-tag-manager/ · Plan: All plans · Updated 2026-10-13 You can install Script Monitoring as a Google Tag Manager **Custom HTML** tag that fires on **All Pages**. It is the fastest way to try Script Monitoring without a code change, but the dashboard marks it as for testing only: GTM does not guarantee script load order, so other scripts may run before the tag can watch them. > **GTM installation is for testing only.** For production, add the tag directly at the top of the ``. See [HTML](https://docs.scriptmonitoring.com/install/html/). ![Install with Google Tag Manager: add the tag as a Custom HTML tag that fires on all pages.](https://docs.scriptmonitoring.com/screenshots/setup-install-gtm-light.webp) ## How do I add the tag in GTM? 1. In the dashboard, open **Developers > Setup**, go to step 3, **Install**, and pick **GTM**. 2. Copy the script tag: ```html ``` 3. In [Google Tag Manager](https://tagmanager.google.com/), create a new tag of type **Custom HTML** and paste the script tag. 4. Set the trigger to **All Pages**. 5. Save and **Publish** the container. 6. Load a page on your site and open Setup step 5, **Verify**. See [Verify it's working](https://docs.scriptmonitoring.com/verify/). ## What does GTM miss? The GTM container itself loads as a script, and it decides when its tags run. Anything that starts before the Custom HTML tag fires, including scripts in your HTML above the container and scripts the container loads first, can run before Script Monitoring is watching. On a single-page app it is worse: the container loads after your bundle, so scripts your app injects at mount can run first. ## What should I do once testing is done? Install the tag directly with [HTML](https://docs.scriptmonitoring.com/install/html/), [Next.js](https://docs.scriptmonitoring.com/install/nextjs/), [Vite](https://docs.scriptmonitoring.com/install/vite/) or the [CLI](https://docs.scriptmonitoring.com/install/cli/), then pause the GTM tag so the script is not loaded twice. ## Frequently asked questions ### Why is GTM only for testing? GTM does not guarantee script load order, so other scripts may execute before Script Monitoring can watch them. For production, use direct ` ``` ## Frequently asked questions ### Which folder does the CLI process? By default it looks for `dist`, then `.next`, in the current directory. Pass `--dir` (or `-d`) to point it at another folder or a single HTML file. ### Is it safe to run twice? Yes. Before injecting, the CLI removes any Script Monitoring tag it finds, so a second run leaves one tag, not two. ### Where in the HTML does it put the tag? Right before the first `` or `