How to add a popup to Drupal

To add a popup to Drupal, paste Popupsmart's embed code into a custom block with the Full HTML text format and place the block in a region on every page, then build popups in the Popupsmart dashboard. Drupal core has no popup builder; Popupsmart runs outside your codebase, so there's no popup module to update.

The steps cover Drupal 7, as screenshotted, and Drupal 10 and 11.

Add a popup to Drupal
Drupal logoPopupsmart logo

Setup at a glance

Runs on
Drupal
Where the code goes
Block layout → a custom block with the code, placed in a region
Add-on
No module needed

Before you start

You need three things:

  • Access to your Drupal site as a user who can administer blocks, or edit the theme if you use the template method.
  • A free Popupsmart account. The free plan covers one website and one live popup, so you can finish this guide without paying.
  • The address your visitors use for the site, which Popupsmart verifies after the install.

The screenshots show Drupal 7. Where the menus differ in Drupal 10 and 11, the steps give both.

How to add a popup to Drupal

A Drupal popup from Popupsmart needs one embed code in a custom block, added once, and the block goes into a region that appears on every page. After that you build, change and publish popups in Popupsmart without opening Drupal again.

Step 1: Copy your embed code

Create a free Popupsmart account, or sign in, and click Embed Code in the left-hand menu.

embed code

Click Copy to clipboard. The code is one line, <script src="https://cdn.popupsmart.com/bundle.js" data-id="…" async defer></script>, and the data-id belongs to your account.

embed code clipboard

Step 2: Create a custom block with the code

In Drupal 7, click Structure in the admin toolbar, then Blocks, then + Add block. Since Drupal 10.1, the block library sits under Content instead: go to Content, then Blocks, and click Add content block.

structure drupal

blocks drupal

add blocks drupal

Enter a Block description that tells you what the block is, such as "embed code". Paste the embed code into the Block body (Body in Drupal 10 and 11) and set the Text format to Full HTML, so Drupal keeps the <script> tag.

block body drupal

Scroll down and click Save block (in Drupal 10 and 11, Save). If the rich-text editor strips the script when you save, pick a text format without an editor, or use the theme method in the next section.

save block drupal

Step 3: Place the block in a region

Drupal 7 lists the new block under Disabled. Change its region from - None - to Header.

embed code region drupal

The block moves to the Header region.

embed code in header drupal

Click Save blocks. In Drupal 10 and 11, go to Structure, then Block layout, click Place block next to a region such as Header, place your block, click Save block, then Save blocks. Block layout is set per theme, so use the tab of your site's front-end theme, not the admin theme.

save blocks after header drupal

Step 4: Add and verify your website

Back in Popupsmart, hover over the profile icon at the bottom left and click Websites.

websites popupsmart

Click + New Website.

new website popupsmart

Enter your Drupal site's address and click Save.

adding website ps

If the site shows as Unverified, click Unverified, then Verify website, and go back to the dashboard and click Refresh. The guide to verifying your website covers the other cases.

Step 5: Create your popup

Click + New Campaign. Name the campaign, choose your Drupal website and click Next.

new campaign

Pick a template. Change its copy, colours and form fields in the Customize and Style steps, choose who sees it in Segment, and click Save.

Step 6: Publish and check the popup on your site

Open the Publish step and click Publish. Then open your site in a private window. The popup appears when its trigger fires.

publishing campaign

Or add the embed code to your theme's html.html.twig

A Drupal theme can carry the embed code instead of a block: paste it just before the closing </body> tag in the theme's html.html.twig, then clear Drupal's caches under Configuration → Development → Performance. Drupal's theming guide suggests either a custom block or a Twig template for third-party scripts like this one. Do it in a custom theme or subtheme you control, because a contributed theme's files are replaced when it updates.

Does Drupal have a built-in popup?

No. Drupal core has no popup builder; Drupal popups come from contributed modules on drupal.org, such as Simple Popup Blocks and Popup Message. As of September 2026, the Simple Popup Blocks project page lists support for Drupal 9.4, 10 and 11, and describes a module that turns any block, view or form into a popup.

Simple Popup Blocks (drupal.org module) Popupsmart
Where it runs Inside your Drupal codebase, on one site Any website that accepts the embed code; paid plans cover several sites (3 on Basic, unlimited on Expert)
What it shows A block, view or form you already have, picked by CSS selector A template built in Popupsmart's editor
When it opens Automatically with an optional delay, on click, or before the browser tab closes Exit intent, scroll depth, time on page, or a click
Pages Not documented URL and device rules on each campaign
Where the leads go Wherever the block's own form sends them The help center lists 19 destinations, including HubSpot, Mailchimp and Klaviyo
Updates Released through drupal.org; stable releases are covered by Drupal's security advisory policy Hosted by Popupsmart; nothing to update in Drupal
Price Free from drupal.org Free plan: one website, one live popup, 5,000 pageviews a month; paid plans from $39 a month

A module like Simple Popup Blocks is a good fit when the popup is a block you already have, such as a newsletter form, and your team is comfortable adding a module to the codebase. Popupsmart earns its install when the popup needs its own design and rules (exit intent, URL and device conditions), leads in an email tool, or the same setup on sites that don't all run Drupal.

How do you show a popup only on some Drupal pages?

Keep the block on every page and choose the pages in Popupsmart. Drupal's block visibility settings can limit the block to some paths, but then every popup you build later is tied to those paths. I'd leave block visibility empty and do the page choice in the campaign's Segment step: click Add audience targeting and add URL Targeting to show or hide the popup on addresses that contain or match what you enter. The help center's page on URL targeting has the details.

Pages are half of the rule; timing is the other half. In Popupsmart's 2026 benchmark, popups that wait before appearing convert 0.83% against 0.61% for popups shown the instant the page loads (median campaign), a lean rather than a proven gap, and exit intent shows no statistically reliable advantage. When a popup fires is worth deciding on purpose, so choose the trigger when you choose the pages.

Drupal runs publishing, university, public-sector and company sites, so start from the job the page has:

Send your Drupal popup leads to your email tool

A Drupal popup's leads belong in your email or CRM tool, not in Drupal. Popupsmart keeps every submission in the Leads section of your dashboard and can send it on to the tool you already use; you connect it in the campaign's Integration section. The HubSpot popup guide and the SendGrid popup guide walk through a connection; the help center lists 19 destinations, and a webhook, Zapier or Make covers a tool that isn't one of them.

Does a popup slow down a Drupal site?

A Popupsmart popup doesn't hold up your Drupal pages: the embed code loads asynchronously (async defer), so the browser finishes building your page before it fetches Popupsmart. Nothing is added to Drupal's server side: no module runs when a page is rendered, and the block is one line of HTML.

When a Drupal popup doesn't appear, work down this list; the first four causes are specific to Drupal.

  • The block is in the wrong theme. Block layout is set per theme; place the block in your front-end theme, not the admin theme.
  • The editor removed the script. Edit the block and check the body still has the <script> line. If it doesn't, save it again with a text format that keeps scripts.
  • Block visibility hides it. If the block has page restrictions, the code doesn't load on the other pages. Remove them and target pages in Popupsmart instead.
  • A cache is serving the old page. Clear all caches under Configuration → Development → Performance, and any CDN cache in front of the site.
  • The website isn't verified, or the address differs. A campaign runs only on a verified website, and www.example.com and example.com are different sites to a browser. See Step 4.
  • The trigger hasn't fired yet. An exit-intent or scroll trigger waits for the visitor to leave or scroll; test in a private window and behave like a visitor.
💬
From the support queue: What I check first on a Drupal install is the block body, not the popup. A text format with a rich-text editor can strip the script tag on save, so the block is placed and looks fine but carries nothing. My advice is to open the block again right after saving: if the script line is gone, switch it to Full HTML or a format without an editor, save again, and clear the caches.

Drupal popup FAQ

Is there a free way to add a popup to Drupal?

Yes. Popupsmart's free plan is permanent, not a trial: one website, one live popup and 5,000 pageviews a month, with Popupsmart branding. It is enough to install the code and run your first popup on a Drupal site.

The Popupsmart pricing page compares it with the paid plans.

Do I need a Drupal popup module?

No. Popupsmart runs from the embed code in a block or your theme, so there is no module to install with your codebase and nothing to update when Drupal core updates. A contributed module such as Simple Popup Blocks is still a fair choice when the popup is a block you already have.

Do I need coding skills to add a popup to Drupal?

No. You paste one line of code into a custom block once and place the block in a region. Everything else, from the design to the targeting, happens in Popupsmart's visual editor.

Which Drupal versions does this work on?

The embed code is one line of plain HTML, so it works on any Drupal version that lets you add a script tag to a page. The screenshots show Drupal 7; in Drupal 10 and 11 the same block is created under Content, then Blocks, and placed from Structure, then Block layout.

How long does it take to add a popup to Drupal?

The Drupal side is one block and one placement; the rest is building the popup. Among people who published a campaign in the 90 days to 16 September 2026, the median time from signup to the first published campaign was 32.5 minutes, and 287 of 332 published within a day, according to Popupsmart's own product data. That figure covers every platform, not Drupal alone.