// JavaScript Integration

AI ready structured data for
JavaScript.

JavaScript powers modern web applications – from SPAs built with React, Vue, or Angular to sites using Google Tag Manager. With enhancely-js, you can add AI-powered JSON-LD schema to any JavaScript-based project, even without backend access.

enhancely automatically generates the right JSON-LD (schema.org) for each page—no manual markup, no brittle scripts.

Important: Most LLM bots (ChatGPT, Perplexity, Claude) do not execute JavaScript. For maximum AI visibility, server-side rendering (SSR) is strongly recommended. Consider using enhancely’s headless CMS plugins (Next.js, Nuxt) for SSR, or combine this JS snippet with a prerendering layer.

graph LR
  A["Browser"] --> B["enhancely-js Snippet"]
  B --> C["Proxy Endpoint"]
  C --> D["enhancely API"]
  D --> E["JSON-LD"]
  E --> C
  C --> B
  B --> F["localStorage Cache"]
  B --> G["Inject JSON-LD in HEAD"]
Fig. 1 — JavaScript client-side integration with proxy endpoint
// How it works

Snippet. Proxy. Inject.

The integration uses a lightweight client snippet and a server-side proxy to keep your API key secure.
01

Load Snippet

Your page loads the enhancely snippet in the <head>.
02

Call Proxy

The snippet calls your proxy endpoint (keeps API key secret).
03

Fetch JSON-LD

The proxy fetches JSON-LD from the enhancely API.
04

Inject

The snippet injects it as <script type="application/ld+json"> in <head>.
05

SPA Support

Automatic re-injection on navigation for single-page applications.
// Features

What you get.

JS
Any Framework
Works with React, Vue, Angular, vanilla JS, or GTM.
SPA
SPA Support
Automatic re-injection on pushState/popstate for single-page apps.
ET
localStorage Cache
ETag-based caching in localStorage with configurable revalidation interval.
// Getting started

Quick setup.

01
Deploy proxy
Set up proxy endpoint at /_enhancely/jsonld (Cloudflare Worker or Node.js)
02
Add snippet
Add enhancely-js config + snippet to <head> or via GTM
03
Verify
Check for <script type="application/ld+json" id="enhancely-jsonld"> in page source

Proxy setup

Cloudflare Worker

# Set environment variables
ENHANCELY_API_KEY=your-api-key
ENHANCELY_API_URL=https://app.enhancely.ai/api/v1
ALLOWED_HOSTS=example.com,www.example.com

Node.js (Docker)

docker build -t enhancely-jsonld-proxy ./proxy/node
docker run --rm -p 8787:8787 --env-file ./proxy/node/.env enhancely-jsonld-proxy

Client snippet

<script>
window.EnhancelyJsonldConfig = {
  proxyUrl: "/_enhancely/jsonld",
  // debug: true,
  // observeSpa: true,
};
</script>
<script>
/* Paste contents of enhancely-js.js here */
</script>

Compatibility & Requirements

Browser: Modern browsers with fetch support

Proxy: Cloudflare Worker, Node.js, or any server

Frameworks: Any (React, Vue, Angular, vanilla JS, GTM)

// FAQ

JavaScript & enhancely
FAQ.

enhancely-js works with any JavaScript setup — React, Vue, Angular, vanilla JS, or Google Tag Manager. The recommended architecture uses a proxy (Cloudflare Worker or Node.js container) to keep your API key server-side and secure. Add the client snippet to your page, and structured data is fetched and injected automatically. No backend framework required — the proxy handles all API communication and caching. Setup takes under 5 minutes.
Yes. enhancely-js is framework-agnostic and works with SPAs. The client-side snippet fetches schema markup via your proxy endpoint and injects the JSON-LD into the page dynamically. For server-side rendered (SSR) applications with Next.js or Nuxt, you can call the enhancely API directly during server rendering — schema markup is included in the initial HTML response, which is optimal for search engine and AI crawler visibility.
Every piece of markup passes through a 3-layer curation pipeline before deployment. Layer 1 (Validity) checks against the full Schema.org specification — all 806 types, every property, every value range. Layer 2 (Factuality) cross-references structured data against your actual page content — no hallucinated data, no invented prices, no phantom opening hours. Layer 3 (Compliance) verifies Rich Result eligibility against Google, Bing, and AI search engine guidelines. Peer-reviewed research (Dang et al., Semantic Web Journal, IOS Press, 2025) showed that without such a pipeline, 40–50% of AI-generated markup is invalid or non-compliant.
Yes. Multiple JSON-LD blocks on a single page are valid and supported by all major search engines — Google, Bing, and others evaluate and merge all structured data blocks they find. enhancely adds additional, validated markup without conflicting with or overwriting your existing schema. If enhancely detects invalid or outdated markup from other sources, Schema Healing can automatically identify and repair it — so legacy schema from previous tools or manual implementations gets fixed and kept current.

Stop leaving
bots hungry.

Your content is already great for humans. Let us make it perfect for bots.