Start for free
Guides/Share a preview

Guides

Share a preview

Let people who are not on your machine comment on a deployed preview, while production stays clean.

For a client or a teammate, deploy a preview and let them comment there. The preview build is opted in with the project’s build secret; a build without it carries nothing of ours. Each project’s Setup tab has these steps with its own values filled in.

Shared mode in your config

The same config as in the Quickstart, with shared mode on wherever ONTRACKD_SECRET is set.

In vite.config.ts, ontrackd() stays first, before the React plugin:

import { ontrackd } from 'ontrackd/vite';

export default defineConfig({
  plugins: [
    ontrackd({ shared: Boolean(process.env.ONTRACKD_SECRET) }), // first
    react(),
  ],
});

In next.config.mjs, the options go after your config:

import { withFeedback } from 'ontrackd/next';

export default withFeedback(
  { /* your config */ },
  { shared: Boolean(process.env.ONTRACKD_SECRET) },
);

<Feedback /> stays once in app/layout.tsx, as in the Quickstart:

import { Feedback } from 'ontrackd/next/overlay';

<body>
  {children}
  <Feedback /> {/* renders nothing in production */}
</body>

In astro.config.mjs, on the integration:

import ontrackd from 'ontrackd/astro';

export default defineConfig({
  integrations: [ontrackd({ shared: Boolean(process.env.ONTRACKD_SECRET) })],
});

In nuxt.config.ts, through Nuxt’s Vite config:

import { ontrackd } from 'ontrackd/vite';

export default defineNuxtConfig({
  vite: { plugins: [ontrackd({ shared: Boolean(process.env.ONTRACKD_SECRET) })] },
});

In vite.config.ts, ontrackd() stays before sveltekit():

import { ontrackd } from 'ontrackd/vite';

export default defineConfig({
  plugins: [
    ontrackd({ shared: Boolean(process.env.ONTRACKD_SECRET) }), // first
    sveltekit(),
  ],
});

With the script tag there is no build and no shared mode: the live site is what reviewers comment on. The Quickstart covers it.

Your dev server, too

Once the app has the secret on your machine (ONTRACKD_SECRET in .env.local or .env, where init puts it), your dev server uses the project as well. The bar asks you to sign in, with GitHub, Google or an email code, as on a preview. Your comments go to the project, with the file and line of the element and the git branch you are on, so your teammates, the dashboard and your agent see them with the preview’s.

  • No address to allow. localhost, 127.0.0.1, *.localhost and *.test (Laravel Herd and Valet) are accepted on any port, for every project. Signing in still needs you to be a member of the project.
  • No build. A dev comment belongs to no deploy: it points at the file and line as they were when you wrote it.
  • To stay local, remove ONTRACKD_SECRET from the app’s env files, or set FEEDBACK_CLOUD_SYNC=0. The bar goes back to a name and comments saved in .feedback/, within a minute. Comments written there before the app was linked stay there.
  • Offline, the page falls back to local mode, and the browser console says why.

What a shared preview gives you

Anyone you let in can comment on the preview, and each comment still knows the file and line behind the element it points at. Without the project’s secret, nobody can read those locations from the preview.

Why production stays clean

Shared mode is on only where ONTRACKD_SECRET is set, and you set it for preview builds only. A production build, built without it, carries nothing of ours. A preview build needs the secret and no other variable.

Which address to allow

Allow one that stays the same between deploys, like your preview branch’s URL. A per-deployment URL changes on every push, and comments from the new one are refused until it is allowed.

Esc

Type to search every page.