Back to blog
June 3, 20255 min read

Embedding Your VidGPT Videos on Any Website

Copy one script tag and every article on your site automatically gets its matching AI video embedded.

Embedding Your VidGPT Videos on Any Website

Once VidGPT has generated videos for your site, you can embed them anywhere with a single <script> tag. Add it once and every page that has a matching video gets a player injected automatically — no per-page work required.

Watch the Video Tutorial

Here's the full embed setup, step by step:

Get the Embed Code

  • Open Sites in your dashboard and select your site.
  • Click Copy embed snippet (also available from the Sites list without opening the site).
  • It looks like this:

    <script src="https://vidgpt.app/widget.js" data-site-id="your-site-id" defer></script>
    

    When the script loads on a page, it calls VidGPT with that page's URL, and if a matching generated video exists it injects a responsive player right into the article — landscape or portrait, matching whatever aspect ratio you rendered the video in.

    Plain HTML Site

    Paste the snippet anywhere on the page — it doesn't need to be at the end of <body>, since it loads with defer:

    <!DOCTYPE html>
    <html>
      <head>...</head>
      <body>
        <!-- your page content -->
    
        <script src="https://vidgpt.app/widget.js" data-site-id="your-site-id" defer></script>
      </body>
    </html>
    

    The widget fetches lazily and fails silently if no video matches, so it never breaks a page.

    WordPress

    Option A — Theme Editor (classic themes)
  • Go to Appearance → Theme File Editor.
  • Open footer.php.
  • Paste the snippet just before </body> and click Update File.
  • Option B — Insert Headers and Footers plugin (recommended)
  • Install the free Insert Headers and Footers plugin.
  • Go to Settings → Insert Headers and Footers.
  • Paste the snippet in the Scripts in Footer box and save.
  • Option C — Block themes (Full Site Editing)
  • Go to Appearance → Editor → Templates → All Templates.
  • Open the template (e.g. Single).
  • Add a Custom HTML block near the bottom and paste the snippet.
  • Next.js

    Add the widget once in your root layout so it loads on every page.

    App Router (app/layout.tsx)
    import Script from "next/script";
    
    export default function RootLayout({ children }: { children: React.ReactNode }) {
      return (
        <html lang="en">
          <body>
            {children}
            <Script
              src="https://vidgpt.app/widget.js"
              data-site-id="your-site-id"
              strategy="lazyOnload"
            />
          </body>
        </html>
      );
    }
    
    Pages Router (pages/_document.tsx)
    import { Html, Head, Main, NextScript } from "next/document";
    import Script from "next/script";
    
    export default function Document() {
      return (
        <Html lang="en">
          <Head />
          <body>
            <Main />
            <NextScript />
            <Script
              src="https://vidgpt.app/widget.js"
              data-site-id="your-site-id"
              strategy="lazyOnload"
            />
          </body>
        </Html>
      );
    }
    

    Use Next.js <Script> (not a plain <script> tag) so Next.js manages the loading strategy correctly.

    Webflow

  • Go to Site Settings → Custom Code.
  • Paste the snippet in the Footer Code box and publish.
  • Shopify

  • In your Shopify admin go to Online Store → Themes → Edit Code.
  • Open layout/theme.liquid and paste the snippet just before </body>.
  • Wix

  • Go to Settings → Custom Code, click + Add Custom Code.
  • Paste the snippet, set Place Code to Body - end.
  • Squarespace

  • Go to Website → Settings → Advanced → Code Injection.
  • Paste the snippet in the Footer field and save.
  • Controlling Placement

    By default the player is inserted right before your article body starts. You can override this per script tag:

    <script
      src="https://vidgpt.app/widget.js"
      data-site-id="your-site-id"
      data-position="after-first-paragraph"
      data-target=".post-content"
      data-max-width="720"
      data-radius="12"
      defer
    ></script>
    
    • data-position — "before-content" (default), "top", "after-first-paragraph", or "bottom"
    • data-target — CSS selector for the content container (default: auto-detects article, .post-content, main, etc.)
    • data-max-width — max player width in px (default 720)
    • data-radius — player border radius in px (default 12)

    Default placement, intro text shown above the player, and whether the "More info" backlink appears are all configurable per-site from the Sites dashboard.

    Embedding a Single Video

    Prefer to place one specific video by hand instead of the auto-matching widget? Open the site's Embed tab and copy the iframe for any finished video:

    <iframe
      src="https://vidgpt.app/embed/your-video-id"
      width="100%"
      height="405"
      style="border:0;border-radius:12px;aspect-ratio:16/9"
      allow="autoplay; fullscreen; picture-in-picture"
      allowfullscreen
    ></iframe>
    

    This same URL (https://vidgpt.app/embed/your-video-id) is a standalone hosted player, so you can also share it directly as a link.

    Downloading the Video File

    Prefer a local file instead of embedding? Open any completed video from your dashboard and click Export & Download to get an MP4 in the aspect ratio you generated it in (16:9 landscape or 9:16 portrait).

    Ready to try VidGPT?

    Turn your first blog post into a short-form video in under 5 minutes. Free — no credit card needed.

    Get started free →