Embed the widget

One script tag connects any page to your local PulseDev server. Here is how to add it and keep it out of production builds.

Updated 28 Oct 20263 min read

Add the script tag

Add your project in the desktop app and click Set up project. It writes this script tag into your index.html when it finds one, or shows you where to paste it (Next.js, Nuxt and most other frameworks). To do it by hand, copy the embed line from the app and paste it before the closing </body> tag of any page you want to review.

index.htmlhtml
<script src="http://localhost:3899/widget.js" data-token="YOUR_TOKEN"></script>

The widget loads from the server's origin, so it follows the port the app started the project on. Each project gets its own port the first time its server starts and keeps it after that, so 3899 here is only an example. Copy the embed line from the app to get the right one.

Load it in development only

The widget talks to a server on your machine. Gate the tag on your dev environment so production builds never include it.

nuxt.config.tsts
export default defineNuxtConfig({  app: {    head: {      script: process.env.NODE_ENV === 'development'        ? [{ src: 'http://localhost:3899/widget.js', 'data-token': 'YOUR_TOKEN' }]        : [],    },  },})

Check that it is connected

Reload the page. The PulseDev button appears on the page. If it never does, open the browser console and look for lines starting with [PulseDev]. Then confirm the server is running by opening its /widget.js address in a browser. More fixes are in Troubleshooting.