How to Integrate OptinMonster with WordPress

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

In this article, you’ll learn three ways to integrate OptinMonster with your WordPress website and why we prefer using the OptinMonster for WordPress plugin.

OptinMonster for WordPress Plugin

The OptinMonster for WordPress plugin makes it easy to manage your OptinMonster campaigns from within your WordPress dashboard. It provides even more powerful targeting options that let you assign campaigns to individual posts, pages, categories, tags, products, custom post types and more.

Using the plugin, you also unlock the option to use WordPress shortcodes in any campaign. That means you can use the shortcodes from your favorite form builder (WPForms, of course) to add complex, custom forms to your OptinMonster campaigns.

And the best part? The plugin does all the work of adding OptinMonster to your site without needing to touch any code at all!

Learn how to install the OptinMonster for WordPress plugin.

Account Wide Embed Code

If you’d prefer not to use the OptinMonster for WordPress plugin, you can simply add your account-wide embed code to your website just before the closing </body> tag. That’s usually in the footer.php file of a WordPress theme. Once you’ve added the account-wide embed code to your site once, launching new campaigns is as simple as toggling them from Draft to Published.

If you’re not comfortable editing your website’s templates, but still want to use the account-wide embed code rather than the plugin, we suggest using the plugin Insert Headers and Footers to safely add your code without risking any damage to your site.

You can find the account-wide embed code here when you’re logged in at optinmonster.com, or on the Publish tab of any campaign.

Google Tag Manager

Another way to add OptinMonster’s account-wide embed code to your WordPress website is using Google Tag Manager. This can be particularly helpful if you’re already using Google Tag Manager.

Learn how to integrate OptinMonster using Google Tag Manager.

Why We Recommend the Plugin

The OptinMonster for WordPress plugin extends the functionality of OptinMonster specifically for WordPress users. Most OptinMonster users can use the Display Rules for all of their campaign targeting. However, your WordPress website may be setup in a way that doesn’t allow you to target campaigns as specifically as you’d like using only the Display Rules.

Here’s an example…

If you wanted to target the cupcakes category on your baking blog, you could configure a campaign’s Display Rules to show it only when the URL contained /category/cupcakes. That would let the campaign appear on any of these URLs:

https://optinmonster.com/category/cupcakes/chocolate-cupcakes
https://optinmonster.com/category/cupcakes/best-cupcake-frosting
https://optinmonster.com/category/cupcakes

But what if your WordPress website’s permalinks are configured NOT to use /category in the URL, or not to show the category slug in your URL? The same URL above would look like

https://optinmonster.com/chocolate-cupcakes
https://optinmonster.com/best-cupcake-frosting
https://optinmonster.com/cupcakes

so there would be no category to target with our Display Rules.

This is where the OptinMonster for WordPress plugin shines!

It allows you to target any post, page, category, tag, product or any number of other post types on your site, even if the URL structure doesn’t give you that opportunity using the Display Rules. These additional targeting options are found in the Output Settings of each campaign in the plugin.

OptinMonster for WordPress Output Settings

In addition, using the OptinMonster for WordPress plugin lets you use any WordPress shortcode in an OptinMonster campaign. It gives you the option to place inline campaigns using a widget, a Gutenberg block or automatically. It even extends your targeting to the WooCommerce cart if you happen to be using Woo to power your store.

And, the plugin does all the work of adding OptinMonster to your site, without you needing to manually add the account-wide embed code.

As you can tell, we think you’ll love the OptinMonster for WordPress plugin. 

When using the OptinMonster for WordPress plugin, your flow for publishing campaigns will look like this:

  1. Create a new campaign. Use the Display Rules in the campaign builder to choose where, when and for whom your campaign can appear. Toggle it to Published and Save. Close the campaign and you’ll be directed immediately to that campaign’s Output Settings in the plugin.
  2. You’ll see the campaign is a Draft in your plugin, even though you Published it in the previous step. That’s because we want to make sure you have the opportunity to review your Output Settings before publishing the campaign live on your site. Keep in mind that the campaign has to meet all the conditions in your Display Rules AND the conditions in your Output Settings before it can appear.
  3. Publish the campaign from your OptinMonster for WordPress plugin.

Here’s a quick video showing that entire process so you can see just how simple it is:

Troubleshooting

My campaign isn’t appearing as expected.

Do your Display Rules conflict with your Output Settings? For example, if you set your Display Rules to only show the campaign on the homepage, but then configured your Output Settings to show on all Posts, the campaign would not display because those two conditions conflict with one another. The campaign can’t show ONLY on the homepage, and also on all Posts at the same time.

I don’t see the option to install the OptinMonster for WordPress plugin on my WordPress.com site, why?

Unfortunately, not every WordPress.com subscription allows plugins to be installed. If you’re using WordPress.com and would like to install the OptinMonster for WordPress plugin, you’ll need their Business or eCommerce subscription. All OptinMonster documentation for WordPress at optinmonster.com is for websites using the self-hosted version of WordPress (wordpress.org).