LinkToast
Back to Integrations
React / Next.js logo

Add the LinkToast widget to React / Next.js

Load the widget loader with next/script or a client effect. The tag mounts once and Studio updates flow through without redeploying your app for content changes.

Prerequisites

  • An active LinkToast account
  • A published widget in Studio
  • Access to the React or Next.js page component where the widget should render

Step-by-step

  1. Publish your widget in Studio

    Publish in Studio and copy the embed code. Note the widget ID in data-widget-id.

  2. Pick where the widget mounts

    Choose a page or layout component, such as a marketing footer or partners section. The script can live in the component tree or in the root layout.

  3. Load the script in Next.js

    Use next/script with afterInteractive so the loader runs after hydration. Replace YOUR_WIDGET_ID with the ID from Studio.

    import Script from 'next/script';
    
    export function LinkToastWidget() {
      return (
        <Script
          src="https://app.linktoast.com/widget-loader.js"
          data-widget-id="YOUR_WIDGET_ID"
          strategy="afterInteractive"
        />
      );
    }

  4. Render the component on your page

    Import LinkToast widget into the page and place it where the Trusted By block should appear. Deploy once. Later Studio publishes do not require a new deploy for widget content.

Troubleshooting

The script does not run in a Server Component file.
Keep the Script tag in a Client Component or a dedicated child component. Server Components cannot emit executable script tags directly.
React Strict Mode runs effects twice in development.
The loader guards against duplicate iframes. If you inject the script manually with useEffect, check for an existing script element before appending.
Content Security Policy blocks the loader.
Add https://app.linktoast.com to script-src in your CSP headers or meta tag so the browser can fetch widget-loader.js.

Create your widget in Studio

Sign up, publish a widget, and paste the embed code on your site.