scriptmonitoring.comdocs

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.

All plansUpdated

The HTML method is one line: paste the Script Monitoring tag at the top of the <head> 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.

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: "Paste it first in <head>."

  3. Click Copy script tag. It copies just the tag:

    <script type="text/javascript" src="https://<teamID>.cdn.scriptmt.com/sm.js" referrerpolicy="origin"></script>
    
  4. Paste it as the first element inside <head> on every page:

    <!-- index.html -->
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <script type="text/javascript" src="https://<teamID>.cdn.scriptmt.com/sm.js" referrerpolicy="origin"></script>
        ...
      </head>
      <body>
      ...
      </body>
    </html>
    
  5. Deploy, load a page on your site, and open step 5, Verify. See Verify it's working.

<teamID> is filled in for you when you copy from the dashboard. It is your own team ID, also shown in the Team ID chip in the top bar. The ID in our examples, 14827391650423, is not a real team: never paste it.

Before you deploy, check the tag against the placement rules: first in the <head>, 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, make sure the domain is listed under Security > Domains, then follow Verify it's working.

Where does the tag go in my framework?#

The tag goes in the file that writes the <head> for every page, as its first element. Put it on every page, including checkout and payment pages: on a site with separate pages, a page without the tag is not monitored.

FrameworkFileWhere
Static HTML, PHP, server templatesEach page, or the shared layout or header includeFirst in <head>
Vite (React, Vue, Svelte, SolidJS)index.htmlFirst in <head>, above the app's <script type="module">
Create React Apppublic/index.htmlFirst in <head>
Next.js App Routerapp/layout.tsxFirst in <head> of the root layout
Next.js Pages Routerpages/_document.tsxFirst in <Head>
Astro, Hugo, Eleventy, JekyllThe base layoutFirst in <head>

On Next.js, use a plain <script>, not next/script, so it stays synchronous and first:

// app/layout.tsx
export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <head>
        {/* eslint-disable-next-line @next/next/no-sync-scripts -- must run before other scripts */}
        <script src="https://<teamID>.cdn.scriptmt.com/sm.js" referrerPolicy="origin" />
      </head>
      <body>{children}</body>
    </html>
  );
}

If you'd rather not find the file yourself, a coding agent does it for you. To add the tag in every build instead, use NPM.

Can I use Google Tag Manager instead?#

For testing, yes: the HTML tile in Setup step 3 has a Google Tag Manager option with the same tag, to add as a Custom HTML tag on All Pages. GTM does not guarantee load order, so for production put the tag in the page. See Google Tag Manager.

What if my team uses an immutable script?#

Any team can pin its tag. In Developers > Setup, step 3, pick HTML and turn on Pinned tag (Subresource Integrity). Super admins and Admins can change it, on every plan. While it is on, the HTML method shows the Immutable script panel instead of the snippet above: a script URL that never changes, with a Subresource Integrity (SRI) value. The browser checks the file against that value and refuses to run anything else, so the tag on your site can't be swapped for a different script.

<script src="https://.../<sha256>.js" integrity="sha384-..." crossorigin="anonymous" referrerpolicy="origin"></script>

Copy the exact tag from the panel (Copy script tag, Copy URL, Copy integrity) and place it at the top of the <head>, 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.

The trade-off: a pinned tag freezes the script and its settings together. Changes you make in the dashboard (rules, blocking, page scope and other settings) and script fixes reach your site only after you install the newly published tag. Turning Pinned tag off stops new pinned builds. Pinned tags you already installed keep working, so switch your site back to the standard tag when you turn it off.

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 script version for your team's Script updates setting (Right away or After a delay, under Install > Advanced). Only an immutable script keeps the version you installed.

Does it work on React, Vite or Next.js?

Yes. Put the tag in the <head> of the HTML shell (index.html) or, on Next.js, the root layout. See Where does the tag go in my framework?

Can I add it to a shared template instead of every page?

Yes. Put it in the layout or template that renders the <head> for every page, as the first script. On a single-page app that is the HTML shell, usually index.html.

Questions? Ask in the chat, or in the dashboard.View as Markdown
Get startedHTML