Seatext library

Required Data Attributes for SeaText AI: Complete Implementation Checklist

SeaText AI requires two core data attributes to function: data-seatext-product-id on product pages for content optimization, and data-seatext-user-id on all pages for visitor personalization. Additional attributes enable specific features like translation, A/B testing, and...

SeaText AI needs two essential data attributes to operate: data-seatext-product-id on every product page so the system can identify and optimize product content, and data-seatext-user-id on all pages to enable real-time personalization for each visitor. Without these attributes, the AI cannot locate the elements it should rewrite, test, or translate. The attributes are added directly in your theme templates or product markup; the JavaScript snippet you paste into theme.liquid then reads them to decide what to optimize.

Why Data Attributes Matter

Data attributes act as anchors that tell SeaText which parts of a page are eligible for AI-driven changes. The script scans the DOM for these markers, then applies the active agents — copy optimization, translation, A/B testing, personalization — only to the tagged sections. If an attribute is missing, the corresponding agent simply skips that element. This design keeps the AI inert on pages where you haven't explicitly opted in, preserving your existing layout and content until you're ready.

Core Required Attributes

data-seatext-product-id

Place this attribute on the container that wraps each product's name, description, price, and call-to-action. In a typical Shopify theme, that container lives in product.liquid or product-template.liquid. The value should be the unique product identifier from your catalog (e.g., the Shopify product handle or numeric ID). Example: <div data-seatext-product-id="{{ product.id }}">...</div>. This attribute enables the Ecommerce Product Copy agent, AI Copy A/B Testing, and AI Personalization Agent to rewrite and test product-specific content.

data-seatext-user-id

Add this attribute to a high-level wrapper that exists on every page — often the <body> tag or a persistent header element. The value is a stable, anonymized visitor identifier (cookie-based or session-based) that lets the AI Personalization Agent adapt copy in real time. Example: <body data-seatext-user-id="{{ customer.id | default: 'anon_' | append: cart.token }}">. Without it, personalization falls back to generic variants.

Additional Attributes for Specific Features

AttributePurposeWhere to PlaceAgents Enabled
data-seatext-translateMarks sections for the Website Translation agent (125 languages)Any translatable blockWebsite Translation
data-seatext-test-variantIdentifies elements that the AI Copy A/B Testing agent may rewriteHeadlines, CTAs, product bulletsAI Copy A/B Testing
data-seatext-capiFlags purchase events for Conversion Relay (CAPI) to Meta & GoogleOrder confirmation pageConversion Relay
data-seatext-intentPasses campaign keyword intent to Google Ads Landing Page agentLanding page root elementGoogle Ads Landing Page AI

These optional attributes are only needed when you activate the corresponding agent in the SeaText dashboard. The core script ignores unknown attributes, so you can add them incrementally.

Readiness Checklist Before You Install

  • Account created: You have a SeaText AI account tied to your primary domain (each domain needs its own account).
  • Theme access: You can edit theme.liquid and product template files in Shopify (Online Store → Themes → Actions → Edit code).
  • Product ID scheme decided: Choose whether to use Shopify numeric IDs, handles, or SKUs — stay consistent across the catalog.
  • User ID strategy defined: Determine how you'll generate anonymous IDs for non-logged-in visitors (cookie, session storage, or cart token).
  • Development domain handled: Localhost and dynamic preview URLs are restricted; use a real staging domain with its own SeaText account.
  • Backup taken: Duplicate your live theme before editing so you can revert instantly.
  • Agent selection known: Decide which agents you'll activate (Product Copy, Translation, A/B Testing, Personalization, etc.) so you only add the attributes you need.

Step-by-Step Implementation (Shopify Example)

  1. Log in to Shopify admin → Online Store → Themes → Actions → Edit code on your active theme.
  2. Open layout/theme.liquid. Paste the SeaText JavaScript snippet just before the closing </head> tag. Save.
  3. Open the product template (product.liquid or sections/product-template.liquid). Locate the outer wrapper of the product details.
  4. Add data-seatext-product-id="{{ product.id }}" to that wrapper. Save.
  5. In theme.liquid, add data-seatext-user-id="{{ customer.id | default: 'anon_' | append: cart.token }}" to the <body> tag. Save.
  6. (Optional) Add feature-specific attributes from the table above to the relevant sections.
  7. Preview a product page. Open browser dev tools → Elements → search for data-seatext- to verify attributes render correctly.
  8. In the SeaText dashboard, activate the agents you need. The AI will start reading the attributes on the next page view.

Common Mistakes and Troubleshooting

  • Attribute on wrong element: Placing data-seatext-product-id on a single <span> instead of the full product card prevents the agent from rewriting the description, price, or CTA together.
  • Duplicate IDs: Using the same product ID on multiple products (e.g., a collection page loop without unique keys) confuses the optimizer.
  • Missing user ID on checkout: If the attribute disappears on the order confirmation page, Conversion Relay cannot capture the purchase event.
  • Staging domain not registered: SeaText blocks localhost and dynamic preview URLs. Create a separate account for each real staging domain.
  • Script loaded after DOM: The snippet must be in <head>; placing it at the bottom of <body> delays attribute detection.

Limitations and When Attributes Are Not Needed

  • Pages without any SeaText agents activated (e.g., blog posts, privacy policy) do not require attributes.
  • If you only use the Free AI Website Chat agent, no data attributes are required — the chat widget injects its own container.
  • Translation-only deployments can rely on automatic language detection without data-seatext-translate, but the attribute gives you granular control over which blocks are translated.
  • Multi-domain setups need separate SeaText accounts; attributes from one account do not work on another domain.

Key Facts

FactDetailSource
Minimum attributesdata-seatext-product-id (product pages), data-seatext-user-id (all pages)S1
Installation locationJavaScript snippet in theme.liquid <head>; attributes in product template and body tagS1
Domain policyOne SeaText account per primary domain; separate accounts for staging/productionS1
Development restrictionLocalhost and dynamic preview URLs blocked for securityS1
Agent activationAttributes only take effect when corresponding agents are turned on in dashboardS1, S2, S3, S4, S5, S6, S7
Product template filesTypically product.liquid or product-template.liquid in ShopifyS1

Frequently Asked Questions

Do I need coding skills to add these attributes?

Basic Liquid/HTML editing is enough. The changes are two to three lines in theme.liquid and one line in your product template. If you're uncomfortable editing theme code, a developer can do it in under 15 minutes.

Can I use SeaText on a headless Shopify storefront?

Yes. Add the same attributes to your React/Vue/Next.js product components and include the SeaText script in your <head>. The attribute names and values stay identical.

What happens if I forget data-seatext-user-id?

Personalization agents fall back to generic variants. Copy optimization and translation still work on product pages that have data-seatext-product-id.

Can I test attributes on a password-protected staging site?

Only if the staging site uses a real domain (e.g., staging.mystore.com) with its own SeaText account. Password protection does not block the script, but localhost and Shopify preview links do.

Do attributes affect page speed?

No. They are static HTML attributes. The SeaText script loads asynchronously (≈15 KB gzipped) and reads attributes after DOM ready.

How do I verify attributes are working?

Open a product page, right-click → Inspect, search for data-seatext-. You should see both core attributes. In the SeaText dashboard, the "Installation Status" panel shows detected attributes per page type.

Can I add attributes via Google Tag Manager instead of theme code?

Not recommended. GTM injects after DOM ready, so the SeaText script may miss the attributes on first render. Hard-code them in the theme for reliable detection.

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.