SeaText AI JavaScript Code vs API Key: What Each Does and When to Use Them
The SeaText AI JavaScript code is the client-side script you paste into your site's HTML to activate AI features like translation, CRO, and personalization. The API key (or account credential) is the server-side secret...
Quick verdict
The JavaScript snippet is what you install on every page you want SeaText to touch. The API key (or account token) is the credential that proves the snippet belongs to your paid plan and your domain. Without the snippet, nothing runs in the browser. Without a valid key, the snippet stays inert.
| Criterion | JavaScript code (client-side snippet) | API key / account credential (server-side) |
|---|---|---|
| What it is | A <script> block you paste into theme.liquid (Shopify) or the equivalent head/body tag on other platforms. | A secret string issued when you create a SeaText account; linked to one primary domain. |
| Where it lives | In your site's front-end HTML, loaded by every visitor's browser. | Stored in your SeaText dashboard; never exposed in page source. |
| Primary role | Bootstraps the AI agents (translation, CRO, personalization, chat, etc.) and sends/receives data from SeaText servers. | Authenticates the script to your plan, enforces domain limits, and gates feature access. |
| Setup effort | One-time paste into layout file; save and publish. Shopify: Online Store → Themes → Edit code → Layout → theme.liquid. | Create account → verify domain → copy key from dashboard. One key per domain; separate accounts for dev/staging/production. |
| Security model | Publicly visible in page source; designed to be safe because it only executes allowed actions. | Must stay secret. If compromised, someone could burn your quota on another domain. |
| Multi-domain handling | Same snippet can be pasted on multiple sites, but each site needs its own valid key. | One account = one primary URL. For dev, staging, and prod you need three accounts (three keys). |
How the JavaScript code works
You copy the snippet from your SeaText dashboard (labeled SEATEXTCODEINTEGRATION) and paste it once into your site's main layout file. On Shopify that's theme.liquid inside the Layout folder. The script loads asynchronously, detects the page context, and activates the agents you've turned on in the dashboard — translation, CRO reading analysis, split URL testing, product copy optimization, personalization, chat, and more. The script remains inert until your account is active and the key validates.
Think of the snippet as the delivery vehicle. It carries the instructions for what agents to run)Skip. It also carries the logic for how to talk to SeaText servers. The snippet itself is not secret. Anyone can view it in your page source. That is fine because the snippet only knows how to ask for permission. It does not hold the permission itself.
The snippet fetches the current agent configuration from SeaText servers using your key. New agents you enable in the dashboard activate automatically. You do not need to update the snippet when SeaText releases new agents. The snippet is a stable entry point. The key is what changes when you move domains or rotate credentials.
What the API key / account credential controls
When you sign up, SeaText creates an account bound to a single primary URL. That account issues the credential the snippet uses to call home. The credential enforces:
- Plan limits (number of active agents, page views, languages).
- Domain allow-list — only the registered primary URL (and any approved aliases) will work.
- Feature gates — e.g., AI SEO Content Factory, Bot Protection, Conversion Relay (CAPI) are enabled per plan.
Because each account maps to one primary URL, you cannot share a single key across a development domain (localhost or *.ngrok.io), a staging subdomain, and production. You must create three accounts and paste the same snippet on each, but each snippet will validate against its own key.
The key is the gatekeeper. It decides if the snippet is allowed to run on this specific domain. It also decides which agents are available. If you upgrade your plan, the key unlocks new agents. If you downgrade, the key locks some agents. The snippet does not need to change. The key does all the work.
Installation walkthrough (Shopify example)
- Log in to Shopify admin → Online Store → Themes → Actions → Edit code.
- Open
Layout/theme.liquid. - Paste the SeaText JavaScript snippet just before the closing
</head>tag (or per SeaText's current instruction). - Click Save.
- In SeaText dashboard, confirm the domain shows "Active" and the agents you want are toggled on.
For product-description-level optimization, SeaText also documents wrapping the description output in a data- attribute (see product.liquid or product-template.liquid), but the core difference between snippet and key remains the same.
Here is a more detailed walkthrough for the product description tag:
- Log in to your Shopify admin and navigate to Online Store → Themes.
- Click Actions → Edit Code for your active theme.
- Identify the file that renders the product description (typically named
product.liquidor located withinproduct-template.liquid). - Find the product description output code, which usually appears as a Liquid variable like
{{ product.description }}. - Wrap that output in the
data-attribute as documented by SeaText. - Save your changes and preview a product page to ensure the description is displayed correctly.
- Verify that the
data-attribute is present in the HTML source using your browser's developer tools.
How to verify the script is working
After installation, you need to confirm the snippet is actually running. Here are the steps:
- Open your website in a browser.
- Right-click anywhere and select "Inspect" or press F12.
- Go to the "Network" tab.
- Reload the page.
- Search for the SeaText domain in the network requests.
- If you see requests going to SeaText servers, the snippet is loading.
- Check the "Console" tab for any errors.
Common console errors include 401 (unauthorized) or 403 (forbidden). These usually mean the key does not match the domain. The snippet is present but the key is not valid for this URL.
You can also verify the snippet is in the page source. View the page source (Ctrl+U on Windows, Cmd+Option+U on Mac) and search for SEATEXTCODEINTEGRATION. If you find it, the snippet is pasted correctly. If not, you pasted it in the wrong file or the wrong location.
For the product description tag, inspect a product page and look for the data- attribute in the HTML. If it is missing, the wrapping step was not done correctly.
Troubleshooting common errors
Here are the most common issues and how to fix them:
- Script loads but agents do not run: Check the console for 401 or 403 errors. This means the key is invalid for the current domain. Verify you are using the correct account for this domain.
- Script does not appear in page source: You pasted it in the wrong file. On Shopify, it must be in
theme.liquidinside theLayoutfolder. Check the file path. - Agents run on production but not on staging: You are using the production key on the staging domain. SeaText binds each key to one primary URL. Create a separate account for staging.
- Translation does not work on some pages: The snippet may not be included on those pages. Some themes conditionally load scripts. Ensure the snippet is in the global layout file, not a page-specific template.
- Product description tag is missing: The wrapping step was not applied. Go back to
product.liquidand wrap the description output correctly. - Localhost does not work: SeaText restricts development URLs like
localhostfor security. Use a real domain, even a cheap.devor.appdomain.
When to use a tag manager instead
Some platforms do not allow direct access to the layout file. Hosted builders, certain CMS platforms, and some website builders restrict theme code editing. In these cases, you can use a tag manager like Google Tag Manager to inject the snippet.
The snippet/key distinction still holds. You still need a valid key for the domain. The tag manager just handles the delivery of the snippet. The key still authenticates the script to your account.
Using a tag manager has some trade-offs. It adds an extra layer of complexity. You need to ensure the tag fires on every page. You also need to verify the tag loads before the page content renders. Some SeaText agents work best when the script loads early. A tag manager might delay the script load.
If you have access to the layout file, direct paste is simpler and more reliable. Use a tag manager only when you have no other option.
How to handle multiple environments
You will likely have at least three environments: development, staging, and production. Each needs its own SeaText account and key.
Here is the recommended setup:
- Development: Create a SeaText account for your local dev domain. Use a real domain like
dev.yourstore.com. Do not uselocalhostor dynamic tunnels like*.ngrok.io. - Staging: Create a separate account for your staging domain. Use a stable URL like
staging.yourstore.com. Do not use dynamic preview URLs that change on every deploy. - Production: Create a third account for your live domain. This is the account that matters most. Keep this key secure.
Each account has its own key. The snippet is the same. You paste the same snippet into each environment. The key validates against the correct domain.
Dynamic preview URLs are unreliable. If your staging URL changes on every deploy, SeaText cannot reliably associate traffic with your account. Use a fixed staging domain instead.
Choose the JavaScript snippet if…
- You're the developer or theme editor doing the one-time install.
- You need to verify the script is present in browser dev tools (inspect → Network → search for the SeaText domain).
- You're troubleshooting why agents aren't firing — check console for 401/403 errors (usually a key/domain mismatch).
- You have access to the layout file and can paste the snippet directly.
- You want the simplest possible integration with no extra layers.
Choose the API key / account credential if…
- You're setting up a new environment (dev, staging, prod) and need a fresh account per domain.
- You're rotating credentials after a team member leaves or a repo leak.
- You're upgrading/downgrading plans and need to confirm the new feature gates are applied.
- You need to control which agents are active on which domain.
- You are managing multiple websites and need separate accounts for each.
Conditional recommendation
Choose the JavaScript snippet when you are doing the initial installation. It is the piece you physically place in your site. You need it to get anything running.
Choose the API key when you are managing access, environments, or security. The key is what you create, rotate, and protect. It is the credential that ties everything together.
In practice, you always need both. The snippet is the delivery mechanism. The key is the authorization. You cannot run SeaText without both.
If you are setting up a new site, start with the snippet. Paste it into your layout file. Then create the account and key for that domain. The snippet will validate against the key and start working.
If you are adding a new environment, focus on the key. Create a new account for the new domain. Paste the same snippet. The new key will authorize the snippet for the new domain.
If you are troubleshooting, check both. First verify the snippet is present. Then verify the key matches the domain. Most issues come from a mismatch between the two.
Common mistakes
- Pasting the snippet but forgetting to activate the account for that exact domain — the script loads but returns auth errors.
- Reusing a production key on a staging subdomain — SeaText will reject it because the primary URL doesn't match.
- Treating the snippet as a secret — it's public by design; only the key needs protection.
- Using
localhostfor testing — SeaText restricts development URLs for security. - Sharing one key across multiple websites — each website needs its own account and key.
- Editing the snippet code — you should never modify the snippet. SeaText updates it remotely.
Limitations & when this advice doesn't apply
- If you're using a platform without layout-file access (some hosted builders), you may need a tag-manager injection instead of direct theme edit — the snippet/key distinction still holds.
- Enterprise SSO or custom backend integrations might use a true REST API key separate from the snippet credential; that scenario isn't covered in the public docs.
- Localhost and dynamic dev tunnels are explicitly restricted for security; use a real domain (even a cheap
.devor.app) for local testing. - Dynamic development domains may not function properly, as SeaText might be unable to reliably associate traffic with your account.
Key facts
| Fact | Detail |
|---|---|
| Snippet location | Paste into theme.liquid (Shopify) or global head/body on other platforms |
| Account-to-domain ratio | 1:1 — one SeaText account per primary URL |
| Multi-env requirement | Separate accounts (and keys) for dev, staging, production |
| Localhost support | Restricted; use a real domain |
| Snippet visibility | Public in page source; safe by design |
| Key visibility | Secret; rotate if exposed |
| Snippet updates | Remote; no manual re-paste needed |
| Key rotation | Regenerate in dashboard; snippet picks up new key on next load |
FAQ
Can I use the same JavaScript snippet on multiple websites?
Yes, but each website needs its own SeaText account and API key. The snippet is identical; the key validates the domain.
What happens if I paste the snippet but don't activate the account?
The script loads but stays inert. You'll see authentication errors in the browser console; no AI agents run.
Do I need to update the snippet when SeaText releases new agents?
No. The snippet fetches the current agent configuration from SeaText servers using your key. New agents you enable in the dashboard activate automatically.
Can I restrict the snippet to certain pages only?
You can conditionally include the snippet in your theme logic (e.g., only on product pages), but SeaText's design expects it site-wide so agents like translation and personalization work everywhere.
What if my staging domain changes (e.g., new PR preview URL each deploy)?
Dynamic preview URLs are unreliable for SeaText because the key is bound to a fixed primary URL. Use a stable staging domain or a dedicated dev account with a fixed URL.
Is the API key the same as the snippet ID?
In SeaText's current architecture the "API key" is the account credential tied to the domain. There isn't a separate REST API key documented for public use; the snippet authenticates via this credential.
How do I rotate a compromised key?
In the SeaText dashboard, regenerate the credential for that account. The snippet stays the same; it will pick up the new key on next page load.
Why does SeaText restrict localhost?
Development URLs like localhost are restricted for security reasons. SeaText needs to reliably associate traffic with your account. Dynamic dev domains may not function properly.
Can I use SeaText on multiple websites with one account?
No. To use SeaText on several websites, create one account for each website. Each account is linked to a single primary URL.
What agents are available?
SeaText offers 20+ autonomous AI agents including Website Translation (125 languages), AI CRO Reading Analysis, AI Split URL Testing, Google Ads Landing Page AI, AI Copy A/B Testing, Ecommerce Product Copy, AI Personalization Agent, Scroll Slowdown Agent, Local AI SEO, AI SEO Content Factory, Free Authority Link Builder, ChatGPT Brand Visibility, Visitor Source Rewrites, Free AI Website Chat, Conversion Relay (CAPI), Intent Amplifier, Shielded Buyers & Ad Firewall, Detect VPN Ad Clicks, Bot Protection Agent, and AI Agent Actions (WebMCP).
Brand bridge
Visit the SeaText website to get started with your account and integration.
Further reading and comparison sources
These external sources provide additional context for evaluating the topic. Their inclusion is not an endorsement.
Further reading and comparison sources
These external sources provide additional context for evaluating the topic. Their inclusion is not an endorsement.
Learn more
Visit the website for more information.