Skip to main content

Install the JS Tag

The simplest way to deploy NxisAI is the client-side JavaScript tag. It works with any static HTML page, CMS (WordPress, Squarespace), or client-rendered SPA. NxisAI injects your validated JSON-LD structured data into the page at runtime and, by default, registers your page's Actions as WebMCP tools.

Which integration should I use?
  • JS tag (this page): the fastest path. Great for static sites, CMSs, and SPAs.
  • SSR SDK: for Next.js, Nuxt, Remix, Astro, SvelteKit, or Express. Embeds structured data in the initial HTML, so LLMs and AI agents that don't run JavaScript can see it.
  • Native integration: for example, Shopify injects schema into your HTML with no tag at all.

Add the script​

Add the script tag to the <head> of your HTML document, before the closing </head>. Replace ${TOKEN} with your site token (available in Site Settings → Installation).

<link rel="preconnect" href="https://cdn.nxis.ai" crossorigin />
<script
type="text/javascript"
async
src="https://cdn.nxis.ai/nxis.js?token=${TOKEN}"
crossorigin="anonymous">
</script>

That's it. When it runs, nxis.js finds your page's structured data and appends a <script type="application/ld+json"> element to the document <head>.

  • The async attribute means the script never blocks HTML parsing or rendering. For what it requests, how that's cached, and what to allow in a Content Security Policy, see How the JS Tag Works.
  • The token carries your site configuration, so no additional data attributes are needed.

The site token​

The token in the URL is public by design. It's meant to sit in page HTML, so it's safe to commit. It only works on the hosts it lists. It carries:

ClaimMeaning
domainsThe hosts the tag works on, up to 10, always including your site's own. Only the host is compared, not the scheme or port, and www. is ignored, so one localhost entry covers every local port. Subdomains need their own entries; wildcards (*, *.example.com) are refused when the token is issued. See Which hosts a token covers.
config.webmcp.modebrowser (default): inject JSON-LD and register WebMCP tools. ssr: register tools only, for pages that already render JSON-LD on the server. none: inject JSON-LD without tools.
expWhen the token expires. Re-issue it before that date.

A token is a JWT, so you can decode its payload to check these values before you deploy it. On a host that isn't listed, the tag logs Nxis: Domain Unauthorized and does nothing. You'll usually see this on deploy previews, whose hostnames change with every build.

You can get a token from Site Settings → Installation, or from the terminal with the CLI:

nxis sites tag status
nxis sites tag issue --domain example.com --domain localhost --webmcp-mode browser

Install via Google Tag Manager​

Prefer to manage tags centrally? Use the GTM snippet from Site Settings → Installation:

  1. In Google Tag Manager, create a new Tag → Custom HTML.
  2. Paste the GTM snippet.
  3. Set the trigger to All Pages.
  4. Save, then Submit and Publish.

See Site Settings → Installation for the exact snippets and the verification flow.

Verify your installation​

After publishing your site changes, return to Site Settings → Installation and confirm the green Verification Successful! badge. If it hasn't appeared yet, make sure the tag is live and the page has been re-crawled.

To check a page yourself, open DevTools on the live site:

  1. Elements: an <!-- Nxis.ai --> comment and a <script type="application/ld+json"> near the end of <head>.
  2. Console: await document.modelContext.getTools() lists your page's Actions (in browser mode).

A note on AI agents​

The client-side tag injects structured data after the page loads in the browser. Search engines render JavaScript, but many LLMs and AI agents do not. If being readable by agents that don't execute JavaScript matters to you, render your structured data server-side with the SSR SDK so it's present in the initial HTML. You can still keep the tag in ssr mode for WebMCP tools.