Add a changelog widget to Next.js
Lytmark is an in-app changelog, public roadmap and feature-voting widget for SaaS products and web apps. Add a “What’s new” panel, an ideas box and roadmap voting to your product with one line of code, for a flat monthly price with no per-user limits.
This guide adds it to a Next.js app with next/script, for the App Router (app/layout.tsx) and the Pages Router (pages/_app.tsx). You’ll get a “What’s new” panel with an unread badge and one-tap reactions on every update. On Pro, the same widget also gets Roadmap and Ideas tabs.
Before you start
- A free Lytmark accountSign up at app.lytmark.com. No card needed.
- Your project IDIt’s on the Install page of your dashboard, already filled into the snippet.
- About 5 minutesOne line of code, pasted once for the whole site.
Install steps
Pathapp/layout.tsx<Script> with strategy="afterInteractive"
-
Copy your snippet
In your Lytmark dashboard, open Install and copy the snippet. Your project ID is already filled in there; in the examples on this page it’s
YOUR_PROJECT_ID.<script src="https://api.lytmark.com/widget.js" data-id="YOUR_PROJECT_ID"></script> -
Add it to your root layout
Add
next/scriptwithstrategy="afterInteractive"to your root layout, so the widget loads once for the whole app and stays through client-side navigation.// 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://api.lytmark.com/widget.js" data-id="YOUR_PROJECT_ID" strategy="afterInteractive" /> </body> </html> ); } -
Pages Router
Pages Router: put the same
<Script>inpages/_app.tsx.// pages/_app.tsx import type { AppProps } from 'next/app'; import Script from 'next/script'; export default function App({ Component, pageProps }: AppProps) { return ( <> <Component {...pageProps} /> <Script src="https://api.lytmark.com/widget.js" data-id="YOUR_PROJECT_ID" strategy="afterInteractive" /> </> ); } -
Deploy, then open it
Deploy, then open your app once. The Install page in your dashboard turns green when the widget loads for the first time.
Use your own button
Prefer a button in your own navigation over the round one? Add data-position="none" to the <Script> and put data-lytmark-trigger on any element:
// The <Script> in app/layout.tsx, without the round button:
<Script
src="https://api.lytmark.com/widget.js"
data-id="YOUR_PROJECT_ID"
data-position="none"
strategy="afterInteractive"
/>
// Anywhere in your app:
<button data-lytmark-trigger>What's new</button>
While there are unread posts, the widget sets data-lytmark-unread on your button, so you can style your own dot.
Check that it works
Open the Install page in your Lytmark dashboard. The first time the widget loads on your site, its status turns green: Live on followed by your site’s host. On your site, the round button appears in the corner you picked in the dashboard (bottom right by default); click it to open the “What’s new” panel.
Using data-consent="pending" or data-track="false"? Then the check waits too: the widget reports your host only once tracking is allowed.
Not showing up?
You haven’t deployed yet
The widget loads wherever the snippet runs. Deploy, then open the deployed site. A local dev server works too: the Install page lists it as a local host.
Your browser shows an old version
Hard-refresh (Ctrl/⌘ + Shift + R) or open the site in a private window. If you use a CDN or cache plugin, purge it.
The code is only on one page
Put it in the shared layout, footer or site-wide settings so every page loads it. The status turns green as soon as any page with the code is opened.
An ad blocker or privacy extension hides it
Try a private window with extensions off. Most visitors don’t block it; this mostly affects your own browser.
Your site has a Content Security Policy
Allow https://api.lytmark.com in script-src and connect-src. Post images come from api.lytmark.com and media.lytmark.com.
script-src 'self' https://api.lytmark.com;
connect-src 'self' https://api.lytmark.com;
img-src 'self' https://api.lytmark.com https://media.lytmark.com;
Videos in posts also need frame-src; see the full list.
Next.js changelog widget FAQ
Does it work with the App Router?
Yes. Put the <Script> with strategy="afterInteractive" in app/layout.tsx and the widget loads once for the whole app and stays through client-side navigation. With the Pages Router, put the same <Script> in pages/_app.tsx.
Will it slow down my Next.js app?
strategy="afterInteractive" loads the script after the page is interactive, and the loader then adds the widget asynchronously. The widget is under 30 KB gzipped and draws inside Shadow DOM, so it doesn’t touch your CSS.
Can I show it only to logged-in users?
There’s no setting for it in Lytmark: the widget shows on every page where the snippet runs. Load it only in the part of your app behind sign-in, for example in the layout of your signed-in route group instead of the root layout. To tell the widget who is signed in, so votes and ideas need no typed email, call Lytmark.identify(); see identify signed-in users.
What happens after a hydration error?
When React renders the whole document again after a hydration error, it removes elements it didn’t render itself. The widget notices and puts itself back.
Does it work with a strict Content Security Policy?
Yes, without unsafe-inline. Allow https://api.lytmark.com in script-src and connect-src. If you use a nonce, the loader passes it on to the widget’s own script.
Add Lytmark to Next.js today.
Free plan, no card. Live in about five minutes.