A client component (works with client-side navigation)
The quickest way to show the widget on any App Router or Pages Router page.
- In VideoTestimonials, open Studio → Widgets, open (or create) a widget, and copy the code from its Code tab (HTML / Script).
- Create a client component that renders the <div> with the same data-vt-* attributes.
- Append the embed.js script in a useEffect, and remove it in the cleanup, so the widget initialises whenever the component mounts.
- Import the component into the page where the testimonials should appear.
"use client";
import { useEffect } from "react";
export function Testimonials() {
useEffect(() => {
const script = document.createElement("script");
script.src = "https://videotestimonials.video/embed.js";
script.async = true;
document.body.appendChild(script);
return () => script.remove();
}, []);
// Copy these attributes from your widget's Code tab.
return <div data-vt-widget="carousel" data-vt-space-id="YOUR_SPACE_ID" />;
}Loading embed.js with next/script in a layout runs it once per visit. Widgets on pages reached later by client-side navigation would not initialise, which is why the script is appended when the component mounts.

