Astro's default treatment of script tags is the one thing that trips people up: a plain <script> is processed, bundled and possibly moved. The widget needs a plain external tag, so the guide uses is:inline. This was checked against the Astro documentation, not tested on a live deployment.
Put it in the layout
Open the layout that every page uses, for example src/layouts/Base.astro, and add the two lines just before the closing </body>:
<div data-popuploom="YOUR_WIDGET_ID"></div>
<script is:inline src="https://popuploom.com/embed/1.2.0/popuploom.js"></script>
If your pages are wrapped differently, put it in the outermost layout. One copy is enough for the whole site.
Why is:inline
Astro processes <script> tags by default. It can bundle the code, add type="module" and deduplicate scripts across the page. That is useful for your own modules and wrong for a third-party tag that must load as a classic script from its own origin.
is:inline tells Astro to leave the tag untouched: same position, same attributes, no bundling. That is the behaviour the widget documents.
Only on some pages
If the popup should not appear sitewide, keep it in the layout but wrap it in a condition based on the route, or move the two lines into the specific page template. Do not add it twice: two divs with the same widget id can initialise the widget twice.
View transitions. Astro's view transitions swap content without a full document load. The script loaded with the first document may not run again for the new page. Triggers that depend on time, click or scroll keep working; URL targeting is the part to test. If a route does not fire when reached through a transition, load it directly or trigger the popup from an event.
Troubleshooting
- The built HTML has a bundled module instead of the tag.
is:inlineis missing, or Astro moved the script into its bundle. Add the attribute and rebuild. - The popup appears twice. The two lines exist in both the layout and a page. Keep one copy.
- Nothing loads and the console shows a CSP error. Add
https://popuploom.comtoscript-srcandconnect-src. - It fires on a direct load but not after a transition. That is the view-transition case above; load the route directly or trigger from an event.
Test checklist
- The rendered HTML contains the div and the script, not a bundled module.
- The popup appears on a fresh load in a private window.
- A test submission reaches the lead inbox.
- Navigation through a view transition behaves as expected.
- If a CSP is set,
https://popuploom.comis allowed inscript-srcandconnect-src.
Removal
Delete the two lines from the layout and redeploy. The saved popup stays in the studio.
Common questions
Why does the script need is:inline in Astro?
Astro processes script tags by default: it bundles them, may add type=module, and can move them. is:inline tells Astro to leave the tag exactly where it is. The widget expects a plain external script in the document, so inline is the predictable option.
Should the snippet go in every page or in a layout?
In a layout that every page uses, once. Repeating it per page invites duplicates and makes the widget id hard to change. If only some pages need the popup, conditionally render the two lines in the layout.
Does the popup work with Astro view transitions?
Test it. View transitions swap page content without a full document load, so a script loaded once may not re-run on the new page. Triggers that depend on time, click or scroll keep working; page targeting is the part to verify.
Can the popup load in a static Astro build?
Yes. The snippet is plain HTML and JavaScript, so it works in static output, server output and hybrid output. No adapter or integration is required.
Official references
- Astro: client-side scripts — how scripts are processed and what is:inline changes.
Written by Shailu016, founder of PopupLoom. Checked against the Astro documentation on 17 November 2026; not tested on a live deployment. No ranking, traffic or conversion claim is made. Related: Next.js, React, static HTML and the general install guide.