How to Integrate OptinMonster with Drupal 8

OptinMonster works on any website where you can add our embed code, including Drupal 8.

In this article, you’ll learn how to integrate OptinMonster with Drupal 8.

Before You Start

Here are some things to know before you begin:

Integrate with Drupal

After you’ve created a campaign in OptinMonster, you’ll want to embed it on your Drupal site.

To add the embed code to your Drupal site, follow these steps:

  1. In the OptinMonster campaign builder, navigate to the Publish view and copy the Global Embed code.
    Copy the embed code for your OptinMonster campaign from the Publish screen of the campaign builder.
  2. Next, log into your Drupal site and select the Structure link from the admin menu.
    Click on Structure
  3. Select Block Layout.
    Click Block Layout
  4. Select the Custom Block Library tab.
    Click Custom Block Library
  5. Next, select the Add custom block button.
    Click Add Custom Block
  6. On the Add Custom Block screen you’ll complete the following steps:
    1. Enter a Block description to easily identify this campaign’s block in Drupal.
    2. Select Full HTML from the text format dropdown.
    3. Select the Source icon in the Body toolbar.
      Add a title, change the text format, select source and paste your code. Then save your custom block.
  7. Finally, paste the OptinMonster embed into the body of the custom block.
    Please be careful to follow the steps above in order. If you paste the embed code BEFORE changing the Text Format or without choosing Source, the script itself will display on your live site.
  8. When you’re finished, click Save.
  9. You’ll be returned to the list view of the Custom Block Library. Click the Block Layout tab.
  10. Locate a Footer region and click the grey Place Block button.
    Place the Custom Block in a Footer region
    Your theme may have several footer regions, you can choose any one of them.
  11. A modal window will appear, select the Place Block button next to the custom block you previously created.
    Click the grey Place Block button next to the custom block you previously created.
  12. Add a Title for your custom block so you can easily identify it in the future, then be sure the Display title option is disabled.
    Give the custom block a title, and do not display the title. Click Save.
  13. When you’re finished, click Save Block.

Troubleshooting

What domain do I enter when creating my campaign?

You’ll want to add the domain that appears in the address bar when you view your website.

If you haven’t registered the domain you want to use in your OptinMonster account yet, you can add the site through the Publish screen in the campaign builder, or through the Account > Sites screen. Learn more about how to register your domain in OptinMonster.

  1. In the Publish view of the campaign builder, be sure the domain is listed under the Websites section. Click Add a website if your domain isn’t already assigned to the campaign to select and add it.
    Add site to the Publish screen for your OptinMonster campaign.
  2. When you’re finished, click Save.