How to Integrate OptinMonster with Drupal 7

OptinMonster can work with any website. The best lead generation tool works on Drupal 7 too! This guide will show you how you can integrate the power of OptinMonster into your Drupal 7 site.

  1. Create and Publish a Campaign
  2. Paste the Embed Code

Step 1 – Create and Publish a Campaign

The first step is to create a campaign and retrieve it’s embed code. See this guide on how to embed your campaigns on your site for a step-by-step walkthrough if you need assistance.

Step 2 – Paste the Embed Code into a Block in Your Drupal Site

Login to the admin of your Drupal site and select the Structure link from the admin menu.

You'll need to navigate to the Structure settings of your Drupal site to begin adding OptinMonster.

This link will load a modal window with several options, select Blocks.

You can add your OptinMonster embed code to a block in Drupal.

On the next screen, select Add block to begin.

From the Blocks modal view you'll need to select Add Block to add a new OptinMonster embed to your site.

On the Add Block screen you’ll complete the following steps:

  1. Enter a Block description to easily identify from the admin.
  2. Paste the OptinMonster embed code you copied earlier into the Block body field.
  3. Select Full HTML from the text format dropdown.
  4. In the Region Settings section, you’ll want to add your block to the footer of your site by selecting that option from the theme dropdown.
  5. (Optional) You can control the Visibility of your campaign based on page, content type and even user.
  6. Finally, select the Save block button.

When adding your Drupal block, there are specific settings you'll want to set when embedding OptinMonster. You can control the visibility of your optin when creating your Drupal Block.

After saving, you’ll be returned to the list view of your Drupal site’s Blocks. If you scroll down to the Footer section you’ll see your new block. If you need to modify the settings at any time you can do so by selecting the Configure link.

You can locate your saved block under the Footer section and modify it's settings later.

If you’re adding an inline type campaign (After Post / Inline or Sidebar), you’ll add either the HTML Placeholder (if using a Sitewide Embed) or the entire Campaign Specific Embed where you want your campaign to appear on the page.

You’re all done! You can now navigate to the front-end of your Drupal site and test your beautiful new campaign!


Q: What domain do I enter when creating my campaign?

A: When creating your campaign you can add your site’s custom domain (the domain used to reach the front-end of your site) in the Setup panel > Optin Campaign Website section of the campaign builder.

You can control which domains your campaign is allowed to load on by adding them to the Optin Campaign Website field.

Q: I have questions about how the Embed Code works.

A: If you have any questions, such as:

  • What domain do I enter when creating my campaign?
  • What’s the difference between the Sitewide and Campaign Specific embed codes?
  • I’m using the Sitewide Embed, how do I control where my campaigns load?
  • I’m using the Sitewide Embed, how do I control where on the page my After Post / Inline or Sidebar campaigns appear?
  • Does the embed code have to be pasted before the closing </body> tag?
  • How do Afterpost and Inline Campaigns work with Embed Codes?

All of the questions above are answered on our main Embed Documentation available here.