OptinMonster can work with any website including Drupal 8, too! This guide will show you how you can integrate the power of OptinMonster into your Drupal 8 site.
There are four steps to add an optin to your Drupal 8 website:
- Create an Optin
- Enable the Optin
- Copy the Optin Embed Code
- Paste the Embed Code
Step 1 – Create an Optin
This step is relatively easy. Check out this document on Creating Your First Optin if you haven’t created an optin yet.
Step 2 – Enable the Optin
When you create a new optin, it’s Paused by default.
Once you’ve finished configuring your optin and it’s ready to be displayed on your site, hover over the status bar in the top menu and choose Start Campaign.
Once your campaign is live you’ll see this status reflected in the top menu bar.
Need to pause your campaign again? You can do that in the optin builder too; simply hover over the status bar again and this time choose Pause Campaign.
Step 3 – Copy the Embed Code
Once you have created your optin, you need to copy the embed code. Click the button titled Embed in the top left of your builder screen.
It will take you to the screen below where you’ll see three embed options:
- Sidewide Embed – Single embed for all campaigns attached to a site.
- Campaign Specific Embed Code – Single embed for this campaign only.
- WordPress – Easy to use plugin for WordPress users. If you plan on using this method please review our in-depth guide to using OptinMonster with WordPress.
If you choose to use the Sitewide Embed Code option, toggle the item to expand its view and you’ll see the embed code you can copy to add to your site.
Important: If you’ve configured your optin to show on multiple different domains in the Setup panel’s Optin Campaign Website field, you’ll see a Sitewide Embed Code for each unique domain.
You must use the appropriate Sitewide Embed Code for each unique domain you want to show your optins on!
If you choose to use the Campaign Specific Embed Code option, toggle the item to expand its view and you’ll see the embed code you can copy to add to your site.
Once you’ve copied the appropriate embed code, you’re ready to move to the next step.
Login to the admin of your Drupal site and select the Structure link from the admin menu.
Next, click Block Layout.
Click Custom Block Library.
Click the blue button “Add custom block.”
On the Add Custom Block screen you’ll complete the following steps:
- Enter a Block description to easily identify this optin’s block in Drupal.
- Select Full HTML from the text format dropdown.
- Select the Source icon in the Body toolbar.
Now you can paste your OptinMonster embed into the body of your 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.
Place the Custom Block
After saving, you’ll be returned to the list view of the Custom Block Library.
Click the Block Layout tab to return to the area where you’ll place your block in the footer region.
Once there, locate a Footer region. If your theme has several footer regions, you can choose any of them.
Click the grey button Place Block.
Click the grey Place Block button next to the Custom Block you previously created.
Configure your custom block by adding a title. Uncheck the box to display the title.
Save your block.
You’re all done! You can now navigate to the front-end of your Drupal site and test your beautiful new optin!
Q: What domain do I enter when creating my optin?
A: When creating your optin you can add your site’s custom domain (the domain used to reach the front-end of your site) in the Setup > Optin Campaign Website section of the optin builder.
Q: What’s the difference between the Sitewide and Campaign Specific embed codes?
A: You may find a specific purpose for each version of embed code to best fit your workflow:
Sitewide Embed: The Sitewide Embed code only needs to be added once to allow all optins that are configured to load on the specific domain to appear. This embed code can save significant time as there is no need to update it when you want to replace or remove an optin. Simply Pause or Delete the optin within your OptinMonster account and that change will be immediately reflected on your website.
Campaign Specific Embed: The Campaign Specific Embed code is unique to the individual optin and must be added everywhere you want that optin to appear. If you wish to embed multiple optins across your site and are using the Campaign Specific Embed you will need to add the unique embed code for each optin where you want that optin to load. If you want to replace or remove an optin you must manually edit the embed code present on your site.
Q: I’m using the Sitewide Embed, how do I control where my optins load?
A: When using the sitewide embed code, it’s important you page-level target your optins using the Display Rules in the optin builder.
Q: I’m using the Sitewide Embed, how do I control where on the page my After Post / Inline or Sidebar optins appear?
A: With the Sitewide Embed option, any After Post / Inline or Sidebar type optins will provide a specific HTML Placeholder in the Sitewide Embed panel you can copy and paste into your page where you want that specific optin to appear.
Q: Does the embed code have to be pasted before the closing
A: No, you can add the embed code anywhere within the body of your site, however there is no reason to add the optin further up the page for popup type optins. Since the optin doesn’t load until the rest of your site has loaded we recommend adding the embed code for any popup type optin just before the closing
AFTER POST / INLINE & SIDEBAR TYPE OPTINS: if you’re adding an inline optin (e.g. After Post / Inline or Sidebar) it’s important to note that the optin will appear on your page exactly where you place the embed code when using the Campaign Specific Embed.
If you’re using a Sitewide Embed on your site you’ll need to add the HTML placeholder as indicated in the Sitewide Embed panel to control where on the page of your site the inline optin appears: