Guides
Move from a pinned plugin version to the hosted script
Switch an existing Databrain embed to the hosted script to get plugin updates without redeploying your app.
Do this with your agent
embed-appearanceMove our Databrain embed from its pinned plugin version to the hosted script. Check account eligibility and the staging manifest. Keep our current design and guest token scope. Ask before applying changes.
Switch from an exact npm version or a versioned CDN URL to the Databrain hosted script. Databrain can then deliver plugin updates without a redeploy of your app.
Before you start
- Confirm that Databrain has enabled the hosted script for your account. Ask your Databrain contact.
- Keep using npm for self-hosted Databrain, pages with proxy authentication, or pages with embeds from multiple Databrain accounts.
- Keep using an exact npm version if your team needs to choose when every plugin update goes live.
If you have an AI agent
An agent with access to your app repository can help make this switch using the Databrain MCP server. The existing embed-appearance skill covers the switch.
Steps
-
Check the current embed in staging. Open each dashboard and metric. Note the values and try the filters, drill and downloads your users rely on. If you also plan to update the plugin, test the new version on npm before switching to the hosted script.
-
Move React components to web components if needed. Replace
<Dashboard />with<dbn-dashboard>or<Metric />with<dbn-metric>. Keep the same guest token and ID. Carry over your options and check the result with the npm plugin first. -
Remove the old plugin registration. Remove the import that registers the tags, such as
@databrainhq/plugin/webor@databrainhq/plugin/standalone. If you use a versioned CDN script, remove that tag. Keep the npm package while your app uses its types or other imports. -
Add the hosted script once on each page with an embed.
<script src="https://cdn.usedatabrain.com/loader/v1/loader.js" async></script>- If your account uses a regional API, set
window.dbn.baseUrlto that API before the script. Check that any existing API settings point to the same host. - If your page sets a Content Security Policy, allow
https://cdn.usedatabrain.cominscript-srcandconnect-src. Keep your Databrain API host inconnect-src. - Leave the script tag’s
integrityattribute unset. The hosted script can change between releases.
- If your account uses a regional API, set
-
Check the switch in a fresh browser window in staging. In the Network panel, find the request ending in
/loader/v1/manifeston your Databrain API host. Check that it returns200with a JSON response and that the loaded plugin matchesurlorfallback.urlfrom that response. Verify that dashboard and metric requests go to the intended API host. Repeat the checks from step 1 before you deploy. -
Keep the previous setup ready to restore. If the checks fail, restore the pinned npm import or CDN tag and remove the hosted script.
If you need a temporary pin
Set data-dbn-pin="<version>" on the hosted script to request a published release. Databrain can override the pin for your account. During an outage, the script can load a different release. Remove the pin when you are ready to receive updates again.
For help with a failed staging check or to turn on the new design later, see Upgrade to the hosted script and the new design.