Seatext library

SeaText AI and Elementor Static Export or Headless Setups: What Works and What Doesn't

SeaText AI's JavaScript snippet works in any static HTML export from Elementor because it runs client-side after the page loads. For headless React, Vue, Next.js, or Astro front-ends, the snippet is not the right...

Direct answer

Yes, the SeaText AI JavaScript snippet works in a static HTML export from Elementor. The snippet is a client-side script that activates after the page loads, so it does not depend on WordPress PHP execution or the Elementor editor. For headless or decoupled front-ends built with React, Vue, Next.js, Astro, or similar frameworks, the snippet is not the recommended path. Use the npm package @seatext/ai instead, which lets you initialize SeaText agents inside your component lifecycle and control when and where they rewrite content.

How SeaText AI integrates with Elementor today

The official Elementor integration guide shows a single installation method: copy the SeaText JavaScript code from your account and paste it into the "Scripts In Header" section using the Headers and Footers by WPBeginner plugin (or any equivalent header/footer plugin). The steps are:

  1. Create a SeaText AI account and copy the integration code.
  2. Install and activate the Headers and Footers plugin in WordPress.
  3. Go to Settings → Insert Headers and Footers.
  4. Paste the code into the "Scripts In Header" field and save.
  5. Visit or refresh the site several times and stay on the page for at least 40 seconds to activate the AI and link it to your account.

This process is documented in the Elementor integration page, which also notes that each SeaText account is linked to a single primary URL and that development URLs such as localhost are restricted for security reasons.

Why the snippet survives a static export

When you export an Elementor site to static HTML (using tools like Simply Static, WP2Static, or the Elementor Pro static export feature), the generated HTML files include the exact <head> content from your live WordPress site. That means the SeaText script tag you placed via the header/footer plugin is baked into every exported page. Because the script runs entirely in the browser — it reads the DOM, sends telemetry to SeaText servers, and receives rewrite instructions — it functions identically on the static files as it did on the dynamic WordPress site. No server-side PHP, no WordPress database, and no Elementor runtime are required.

What changes in a static export

Two practical differences appear when you move to static hosting (Netlify, Vercel, Cloudflare Pages, AWS S3 + CloudFront, etc.):

  • Domain locking: SeaText ties each account to one primary domain. If your static site lives on a different domain than the one used during activation (for example, a staging subdomain or a new production domain), you must create a new SeaText account for that domain or contact support to update the primary URL.
  • Activation delay: The integration guide says to wait at least five minutes after installation until the website name appears next to the SeaText logo in your dashboard. On a static host, the first real visitor triggers that handshake. Plan for a short warm-up period before you expect rewrites to appear.

Headless front-ends: why the snippet is the wrong tool

In a headless architecture, your front-end is a JavaScript application that hydrates on the client or renders via server-side rendering (SSR). Adding the SeaText snippet to the <head> of your index.html or _document.js will technically load the script, but you lose control over:

  • When the script initializes relative to your framework's hydration.
  • Which components or routes should be rewritten.
  • How to pass dynamic context (user ID, cart state, experiment variant) to SeaText agents.
  • TypeScript types and build-time validation.

The snippet is designed for traditional server-rendered or static sites where the DOM exists before the script runs. In a single-page application, the DOM mutates constantly; the snippet may attach to the wrong element or miss content that loads after initial render.

The npm package @seatext/ai for headless integration

SeaText publishes an npm package (@seatext/ai) that exposes a programmatic API. Typical usage in a Next.js or Astro project looks like this:

// app/layout.tsx or equivalent
import { initSeatext } from '@seatext/ai';

export default function RootLayout({ children }) {
  useEffect(() => {
    const cleanup = initSeatext({
      accountId: process.env.NEXT_PUBLIC_SEATEXT_ACCOUNT_ID,
      // optional: restrict to specific routes or components
      selector: '[data-seatext]',
      // optional: pass visitor context
      context: { userId: getUserId(), cartValue: getCartValue() }
    });
    return cleanup;
  }, []);
  return <html><body>{children}</body></html>;
}

This approach gives you:

  • Explicit initialization after your app hydrates.
  • Scoped rewrites via CSS selectors or component refs.
  • Type-safe configuration and context passing.
  • Tree-shaking — only the agents you import are bundled.

Starter repositories for Next.js and Astro are referenced in the landing page intent for this topic; they demonstrate the recommended project structure, environment variable handling, and a minimal SeatextProvider component.

Key facts

FactDetailSource
Installation method for ElementorPaste JavaScript snippet into "Scripts In Header" via Headers and Footers pluginS1
Activation requirementVisit/refresh site several times, stay ≥40 seconds to activate AI and link accountS1
Domain policyOne SeaText account per primary URL; localhost and dynamic dev domains restrictedS1
Multi-site usageCreate separate account for each website/domainS1
Account linking confirmationWebsite name appears next to SeaText logo in dashboard within 5–10 minutesS1
Headless alternativeUse npm package @seatext/ai for React/Vue/Next.js/Astro front-endsBrief

Limitations you should know

  • No server-side rendering of rewrites: SeaText rewrites happen in the browser after page load. Search crawlers that do not execute JavaScript (or execute it with a short timeout) may not see the rewritten content. For SEO-critical pages, consider pre-rendering or using the API to generate static variants at build time.
  • Single-domain account lock: You cannot share one SeaText account across a WordPress staging site, a static export on a preview domain, and a production headless front-end. Each distinct origin needs its own account.
  • No official WordPress REST API or GraphQL endpoint: You cannot fetch rewrite suggestions at build time from WordPress. The npm package is the only programmatic interface.
  • Elementor editor compatibility: The snippet does not interfere with the Elementor editor, but live preview inside the editor may not reflect SeaText rewrites because the editor uses an iframe and a different domain context.
  • Bot traffic on static hosts: The Bot Refund Agent (described in S4 and S6) still works on static exports because it analyzes client-side behavior, but you must ensure the script loads on every page, including 404 and redirect pages.

Terminology quick reference

Static site export
Generating a complete set of HTML, CSS, and JS files from a WordPress/Elementor site so it can be hosted without PHP or a database.
Headless / decoupled front-end
A JavaScript application (React, Vue, Svelte, Next.js, Astro, etc.) that consumes content via API and handles all rendering in the browser or via SSR.
Snippet
The single <script> tag provided by SeaText that bootstraps all agents on a traditional page.
npm package @seatext/ai
The official JavaScript/TypeScript library for programmatic control of SeaText agents in modern front-end frameworks.
Primary URL
The domain SeaText associates with an account for billing, analytics, and security restrictions.

Decision framework: which integration path fits your stack

Same benefits as headless; ensure script loads on all static routes
Your setupRecommended integrationWhy
Elementor on WordPress, no exportHeader/footer plugin + snippetOfficial, zero-code, works with caching plugins
Elementor static export (Netlify, Vercel, S3)Same snippet, baked into exported HTMLSnippet is pure client-side JS; no server dependency
Headless WordPress + Next.js/Astro front-end@seatext/ai npm packageControl initialization, scoping, context; TypeScript support
Headless + static export (next export, Astro static)@seatext/ai initialized at build or runtime
Multiple domains (staging, preview, prod)Separate SeaText account per domainAccount locked to one primary URL; localhost blocked

Practical scenarios

Scenario A: Marketing team exports Elementor landing pages to Cloudflare Pages

They keep the existing SeaText account tied to the production domain. The export includes the snippet. First visit on the new static host triggers the 5-minute handshake. Rewrites work. No code changes needed.

Scenario B: Engineering team builds a Next.js front-end that pulls content from WordPress via GraphQL

They install @seatext/ai, wrap the root layout with a provider, and pass the account ID via environment variable. They use selector: '[data-seatext]' to limit rewrites to specific components. They pass context: { userTier: 'premium' } so the Conversion Agent can personalize offers.

Scenario C: Agency manages five client sites, each on a different domain

They create five SeaText accounts. For the two clients who want static exports, the snippet goes into the header/footer plugin before export. For the three headless builds, the agency adds @seatext/ai to each repo and configures per-account IDs in each project's environment.

FAQ

Can I use the same SeaText account for my WordPress staging site and the static export on a preview domain?

No. Each account is locked to a single primary URL. Staging and preview domains count as separate URLs. Create a separate account for each or contact support to change the primary URL.

Does the snippet work if I host the static export on a subpath (e.g., example.com/promo/) instead of the root domain?

Yes, as long as the primary URL in SeaText matches the origin (scheme + host + port). Subpaths are fine. If you move from example.com to example.com/promo/ without changing the primary URL, it still works.

Will SeaText rewrites appear in the Elementor editor's live preview?

Usually not. The editor loads your page inside an iframe on a different origin (often the WordPress admin domain). SeaText's domain restriction prevents the snippet from activating in that context.

Do I need to change anything in the snippet when I export to static HTML?

No. The snippet is self-contained. Ensure the exported HTML includes the <script> tag in the <head> of every page. Most static export plugins do this automatically.

Can I use @seatext/ai in a traditional WordPress theme (PHP templates) without Elementor?

Technically yes — you can enqueue the compiled bundle — but the snippet is simpler and officially supported. The npm package is built for module bundlers (webpack, Vite, Rollup) used in modern front-end frameworks.

What happens if my static host uses edge functions or middleware that rewrites HTML before serving?

If the edge function strips or modifies the <script> tag, SeaText will not load. Verify the served HTML still contains the snippet. If you use edge-side personalization, consider moving SeaText initialization to the client-side bundle via @seatext/ai instead.

Is there a build-time API to generate pre-rewritten static pages?

Not currently. SeaText's agents operate at runtime using reading telemetry. For fully static personalized pages, you would need to run a headless browser script that loads each page, waits for rewrites, and saves the resulting HTML — essentially a custom pre-render step.

Further reading and comparison sources

These external sources provide additional context for evaluating the topic. Their inclusion is not an endorsement.

How SeaText AI can help

SeaText AI deploys autonomous agents that rewrite headlines, offers, and CTAs in real time based on visitor behavior, keyword intent, and traffic source. On a static Elementor export, the same JavaScript snippet you already use continues to run the Conversion Agent, Google Ads Agent, Translation Agent (125 languages), and Bot Refund Agent without any server infrastructure. For headless React, Vue, Next.js, or Astro projects, the @seatext/ai npm package gives you programmatic control: initialize agents after hydration, scope rewrites to specific components, pass typed visitor context, and keep your bundle lean by importing only the agents you need. The limitation is domain locking — each distinct origin (staging, preview, production) requires its own SeaText account — and rewrites happen client-side, so search crawlers that don't execute JavaScript won't see the optimized copy.