Integrate the TrendSync plugin across modern web stacks.
This guide is based on the current project implementation: the official loader script, the API-key metadata endpoint, the indexing webhook, and the WordPress plugin settings already shipped in this codebase.
React
Client-side integration for SPAs or Vite/CRA projects.
JavaScript Websites
Fastest drop-in option for plain HTML sites and static pages.
PHP
Server-rendered metadata for custom PHP sites and frameworks.
WordPress
Official plugin with settings, verification, caching, and status reporting.
Next.js
Use either the loader script or fetch metadata in the App Router.
How TrendSync Works
Every connector in this project follows the same runtime contract, so once the credentials are ready you can plug it into almost any stack.
TrendSync stores the selected metadata recommendation for a client.
Your site calls `GET /api/plugin/metadata` with the `X-Api-Key` header.
The response includes title, description, keywords, Open Graph, Twitter Card, structured data, and canonical URL.
After successful injection, the connector can notify TrendSync with `POST /api/indexing/metadata-injected`.
Before You Start
Official Loader Script
Use this when you want the browser to fetch metadata and inject it automatically. This is the same contract exposed by `backend/controller/pluginController.js`.
<!-- Place this inside <head> -->
<script
async
src="https://api.yourdomain.com/api/plugin/trendsync.min.js"
data-api-key="YOUR_API_KEY"
data-auto-inject="true"
></script>Optional Injection Reporting
After metadata is applied, your connector can notify TrendSync so automatic indexing workflows can continue.
await fetch("https://api.yourdomain.com/api/indexing/metadata-injected", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY",
},
body: JSON.stringify({
url: window.location.href,
metadataType: "full",
}),
});Framework Guides
Open only the guide you need. Each section expands with the setup notes and code examples for that stack.
<head> updates.import { useEffect } from "react";
export function TrendSyncLoader() {
useEffect(() => {
const script = document.createElement("script");
script.src = "https://api.yourdomain.com/api/plugin/trendsync.min.js";
script.async = true;
script.dataset.apiKey = process.env.REACT_APP_TRENDSYNC_API_KEY || "";
script.dataset.autoInject = "true";
document.head.appendChild(script);
return () => {
document.head.removeChild(script);
};
}, []);
return null;
}// App.tsx
import { TrendSyncLoader } from "./TrendSyncLoader";
export default function App() {
return (
<>
<TrendSyncLoader />
{/* your routes */}
</>
);
}