Installation guide · Next.js and React
PROJECT RELAY

Install Relay in
Next.js or React.

Render the signed container in your route and load the widget once after the page becomes interactive. The recommendation content remains controlled by your Relay approvals.

App Router compatiblenext/scriptNo npm package
01Create slot
02Add component
03Deploy route
04Verify live

1. Create the signed slot

In Dashboard → Products, create a recommendation slot and save the exact production route that will render the component.

Replace both placeholders. Copy your real signed token from the dashboard into both data-project-relay-slot and data-slot. Do not publish the literal YOUR_SLOT_TOKEN value.

2. Render the slot and load the script

For Next.js, use next/script with the dashboard-recommended afterInteractive strategy. This loads the widget after hydration without blocking the route.

RelayRecommendation.tsx
import Script from "next/script";

export function RelayRecommendation() {
  return (
    <>
      <div data-project-relay-slot="YOUR_SLOT_TOKEN" />
      <Script
        src="https://relaymyproject.com/widget/v1.js"
        data-slot="YOUR_SLOT_TOKEN"
        strategy="afterInteractive"
      />
    </>
  );
}

Render <RelayRecommendation /> at the intended location. If a shared layout can render more than once, keep the script in the layout and render only the signed container in each route.

React without Next.js

Render the signed container in your component and load the dashboard-generated script once from your document template or application shell. Avoid injecting a raw script tag during every component render.

3. Deploy the exact route

Deploy the application and open the saved path over public HTTPS. Confirm that redirects settle on the same page recorded in Relay and that authentication, preview protection, or middleware does not block it.

FINAL CHECK

Run “Test live installation”

Relay fetches the production route and confirms the signed slot token is present. Successful verification unlocks matching; it does not publish a recommendation until the required approvals are complete.

Troubleshooting

  • View the production DOM and confirm the signed div exists after deployment.
  • Make sure the token in the container matches the data-slot passed to Script.
  • Load the widget script once; duplicated application-shell scripts can create confusing behavior.
  • If you use a content-security policy, allow https://relaymyproject.com as a script source.
  • Verify the route without a developer login, preview cookie, or deployment password.

Ready for your signed component?

Add and verify your product first, then Relay will generate the slot token bound to the production route you choose.

Get founding access →Request guided installation