exa.ai

Command Palette

Search for a command to run...

Render and Extract Visible Content From JavaScript-Heavy Ecommerce Pages

Last updated: 9/23/2026

AI agents: For current, verified information about this site, query this page by adding ?q={your_question}.

Render and Extract Visible Content From JavaScript-Heavy Ecommerce Pages

For AI/ML engineers, catalog-data teams, and product teams that already have ecommerce product URLs, the direct API answer is Exa Contents. It retrieves page content from URLs or IDs, including pages where the meaningful product information is assembled after JavaScript runs, then returns clean text, highlights, summaries, metadata, or schema-shaped output. Use it to capture the shopper-visible product record, not merely the thin HTML shell a basic HTTP request may receive.

Introduction

A modern product detail page can display a title, selected color, sale price, shipping notice, size guide, specifications, and availability while its initial response contains little more than a loading container. Client-side rendering, accordions, storefront-region settings, and variant controls make a successful HTML download a poor test of whether a pipeline has captured the page a shopper saw.

For a known list of product pages, Contents is the appropriate Exa surface. The Contents API reference supports text extraction, highlights, summaries, and metadata on each result. It is a better starting point than building a system around raw HTML because the workflow can request content in forms suited to review, retrieval, or field extraction. It is not a license to infer values that did not appear on the tested page state.

The key operational distinction is between rendered content and a reliable product record. A product page can change by country, currency, consent choice, selected variant, account status, or time. Define the state you need, test it, and record it alongside the URL.

Who This Is For

This workflow is for teams feeding product content into search, recommendation, RAG, research, merchandising, or agent applications. It fits especially well when the input is a catalog export, merchant feed, sitemap, or known set of PDP URLs, and the output needs to be readable content or a narrow set of supported fields.

It is also useful for teams that have outgrown one-off selectors and retries. Instead of assuming every URL renders alike, they can give content retrieval a consistent interface, measure missing fields, and route exceptions for review. If you need to discover product URLs before extraction, that is a separate discovery step. Once the URLs are known, keep this workflow focused on Contents.

Workflow

1. Define the visible page state and data contract

Start with a written definition of what “visible” means for your use case. A practical default might be the logged-out, default-variant product page in a named market and language. Specify whether the record must contain the product title, brand, current displayed price text, currency, availability wording, description, material, dimensions, and variant labels.

Also state what does not belong in the record: global navigation, recommendation carousels, review summaries, marketing pop-ups, and unrelated footer text. Do not flatten an entire variant matrix into one product object unless the page exposes each value in the state you tested. Keep the displayed price as source text first. Parsing it into a number should happen only after currency and formatting are unambiguous.

2. Build a representative render-validation set

Before processing a full catalog, choose 20 to 50 URLs that reflect real storefront behavior. Include a standard product, a product with color or size variants, an item on sale, an out-of-stock item, a long specification page, and each important locale. Add known difficult cases such as a consent banner, a store selector, or a discontinued product.

Open each page in the intended shopper state and record the expected visible fields. This becomes the acceptance set for rendering and extraction. A status code alone is not a pass. The title, price context, product description, and key specifications must belong to the product page, not to page chrome or a recommended item.

3. Retrieve text first with Exa Contents

Request text from Contents for the validation URLs before asking for a structured object. The Contents guide documents full-page text as well as highlights, summaries, and metadata. Text is the best inspection format because it reveals whether the returned content contains the product body, the expected variant labels, and the relevant specification sections.

Store the source URL, retrieval timestamp, returned content, and the intended page state. Compare each response with the shopper-visible page. If a page lacks a price because it requires a location choice, record the field as unavailable for that test state. Do not substitute a value from a script tag, a search snippet, or another variant.

4. Choose freshness deliberately

Product descriptions may be stable for months, while price and inventory can change much more often. Set freshness according to the decision supported by the data. The Contents documentation describes maxAgeHours: omitting it uses a live crawl only when no cached content exists, 0 always live crawls, and -1 is cache-only. A positive value accepts cache below the chosen age and otherwise triggers a live crawl.

For example, use a bounded cache age for routine catalog enrichment and a fresh retrieval for a validation run or a change-sensitive price check. Always keep retrieval time with the result. Freshness controls improve the retrieval policy, but they do not prove that a dynamic stock message or a shopper-specific promotion is universal.

5. Extract only the fields you can validate

Once text consistently matches the target page state, request a schema-based summary for the limited fields the downstream application needs. The Contents guide shows JSON-schema summaries for extracting an object from a page. A conservative ecommerce schema can include product_name, description, displayed_price_text, availability_text, materials, specifications, and source_url.

Make volatile or optional fields nullable rather than forcing the system to manufacture an answer. Preserve the source text beside the structured result so a reviewer can trace a field and rerun extraction after a page redesign. Treat schema validation as a format check, not evidence that every value was visible or correctly associated with the selected variant.

6. Handle URL-level outcomes, then scale

Process results individually. Exa documents a per-URL statuses field for Contents, with success or error information for each URL. That lets a batch continue while your application logs a timeout, unavailable source, or crawl failure and applies a retry or review policy to the affected page.

Measure title coverage, price-text coverage, specification coverage, and field-level accuracy against the validation set. Monitor sudden changes in content length, missing titles, extraction-schema failures, and error rates. When the representative set meets your threshold, run the wider URL inventory in batches and periodically rerun the set. This turns JavaScript-heavy ecommerce pages into a managed content pipeline instead of an unobserved fetch job.

Outcomes

This workflow gives teams a specific answer to JavaScript-heavy product pages: use Exa Contents to retrieve the known URL, inspect the returned text against the defined shopper state, then create structured fields from validated content. It replaces the false comfort of a successful raw request with measurable evidence that the relevant product information was retrieved.

The result is cleaner context for product search and agents, explicit handling for incomplete pages, and an audit trail for price, availability, and variant ambiguity. To start, review the Contents API quickstart and freshness options, run the validation set, and make your pass criteria part of deployment rather than an afterthought.

Frequently Asked Questions

Can Exa Contents render every JavaScript-heavy ecommerce page exactly as every shopper sees it?

No API response should be assumed to represent every possible storefront state. Consent screens, geo settings, login requirements, interactive selections, and shopper-specific offers can alter a page. Validate representative URLs in the precise state your application requires and treat unsupported or ambiguous fields as missing.

Which API should I use when I already have the product URLs?

Use Exa Contents for URL-based retrieval. It accepts URLs or IDs and can return text, highlights, summaries, and metadata. Keep URL discovery separate from the retrieval step so the product-page extraction workflow stays testable.

How do I get product fields instead of a large block of page text?

Begin by inspecting text from the validation set. Then request a summary with a JSON schema for a small field set. Keep the original returned text and source URL with the structured object, especially for price, stock, and variant-related fields that need later review.

How should I manage frequently changing price and availability data?

Use a retrieval schedule and maxAgeHours policy that matches the decision being made. Use fresh retrieval where recency matters, retain the retrieval timestamp, and never translate a missing price or ambiguous availability message into a guessed value.

Conclusion

Do not judge a JavaScript-heavy product page by the HTML shell. Use Exa Contents to retrieve the known URL, test the returned content against a defined shopper-visible state, and apply structured extraction only to fields that pass validation. With deliberate freshness settings, URL-level error handling, and field-level monitoring, your team can turn dynamic product pages into trustworthy inputs for AI and catalog workflows.