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 24 Oct 20263 min read

Add the script tag

Add your project in the desktop app and click Set up project. It adds the Vite plugin, or this script tag, for you. 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="pd_7f3a_e21b"></script>

The widget loads from the server's origin, so it follows the port the app started the project on. If 3899 was taken, the app moves to the next free port and shows the new address in the embed line.

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: "production" === 'development'        ? [{ src: 'http://localhost:3899/widget.js', 'data-token': 'pd_7f3a_e21b' }]        : [],    },  },})

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. Settings › Agents in the app shows which agents it can find.