# Installing OptiMonk on a WordPress website

Canonical URL: https://support.optimonk.com/en/articles/installing-optimonk-on-a-wordpress-website

On WordPress you don't paste a code snippet — the official OptiMonk plugin inserts the code for you. All you need from OptiMonk is your **OptiMonk ID**, and the app hands it to you inside the installation guide.

Whether you run WordPress.org or WordPress.com, the admin looks a little different, but the steps are the same. If your site is a WooCommerce shop, there is one extra step at the end that lets OptiMonk read your product catalog.

---

## Where the guide is in OptiMonk

1. Open **Settings** from your account menu, then the **Domains** tab.
2. Find your site in the list. The row says **Code inserted** or **Not inserted**.
3. Click the row of a domain that is not connected yet. OptiMonk looks at your site (*Looking at your site…*) and, if it recognises the platform, shows a card: *We recognized your platform: Wordpress / Woocommerce*, with **What you'll do** and a **Connection guide** button.
4. If nothing is recognised, you get the picker instead — **What e-commerce platform do you use?** — where you choose **Wordpress / Woocommerce** yourself.

You will meet the same guide from a campaign: right after you publish, the **Install the snippet** page appears, and inside a campaign the **Insert code** dialog opens it too.

Tip: add the domain first if it isn't on the list. Type it into **Type a new domain, e.g. example.com** at the top of the Domains tab and click **Add**.

---

## Step 1 — Install the OptiMonk plugin on your WordPress site

1. Log in to your WordPress site and click **Plugins** on the left, then select **Add new**. Click the **Search** bar, search for **OptiMonk**, and click **Install Now**.
2. Click **Activate**.
3. After the activation has finished, you'll find the OptiMonk plugin in the list of **Installed Plugins**.

If the plugin is already there but old, update it to the [latest version](https://wordpress.org/plugins/exit-intent-popups-by-optimonk/) — the WooCommerce step in this guide needs a recent one.

---

## Step 2 — Insert your OptiMonk ID number

You no longer have to dig your ID out of a URL. The guide's second step is titled **Insert your OptiMonk ID number: <your ID>** and shows the number itself.

1. Copy your OptiMonk ID from the step.
2. Go back to the WordPress admin page, navigate to **Appearance** on the left and select **OptiMonk**. Insert your OptiMonk ID number into your OptiMonk WordPress plugin.
3. Click **Save Changes** to finish the setup.

---

## Step 3 — Make sure your cache plugin doesn't interfere

OptiMonk may not work immediately on WordPress sites because of a cache plugin. These plugins speed sites up by compressing and serving pre-generated HTML — which also means an old copy of your page, without the OptiMonk code, can keep being served.

The guide asks for two things:

1. Add these domains to the cache ignore list:

- `https://onsite.optimonk.com`
- `https://front.optimonk.com`
2. Purge the cache on your website.

You can check whether your site is cached at [cache-checker.com](https://cache-checker.com) — any form of **Cache hit** means a cached copy is being served.

The rest of this section covers the most common plugins one by one. Nothing here has changed on the WordPress side.

### Autoptimize

Open Autoptimize and, under **JavaScript Options**, add these to **Exclude scripts from Autoptimize**:

- `https://onsite.optimonk.com`
- `https://front.optimonk.com`

Autoptimize also has to load the OptiMonk script asynchronously. On the **Extra** tab of the Autoptimize settings page, add `https://onsite.optimonk.com/script.js` to **Async Javascript-files (advanced users)**.

Autoptimize puts a small toolbar at the top of the page: click **Autoptimize** → **Clear CSS/JS Cache**. Then load your site and your OptiMonk campaign should appear.

### Comet Cache

Open **Comet Cache** from the left side menu of the WordPress dashboard and click the **Clear** button (the small brush icon) at the top right of the page.

### LiteSpeed Cache

LiteSpeed Cache usually sits in the WordPress toolbar. Click the LiteSpeed icon and choose **Purge All**. On LiteSpeed Enterprise, clearing the CDN cache can take a few moments.

### Nginx Helper

Nginx caching normally happens on the server (FastCGI or redis-cache), but the Nginx Helper plugin lets you clear it from WordPress. Depending on your settings, click **Purge Cache** in the top toolbar.

If **Enable Purge** is switched off, the toolbar button is missing. In that case go to **Settings → Nginx Helper** from the dashboard side menu and purge the whole cache from the plugin page.

### WP Rocket

Add the following OptiMonk URLs both to the **Remove from JavaScript Deferred** list and to the **Minify JavaScript Files** exclusion list:

- `https://onsite.optimonk.com`
- `https://front.optimonk.com`

WP Rocket's own documentation covers both lists: [exclude files from defer JS](https://docs.wp-rocket.me/article/976-exclude-files-from-defer-js) and [find the right JS files to exclude from minification](https://docs.wp-rocket.me/article/915-find-the-right-js-files-to-exclude-from-minification). Once they are saved, clear and preload the cache.

### WP Super Cache

WP Super Cache puts a **Delete Cache** link in the top toolbar — clicking it is enough. If the link isn't there, go to **Settings → WP Super Cache** in the left menu, scroll down a little and use the **Delete Cache** button.

---

## Step 4 — Connect WooCommerce (webshops only)

This step only appears if your site is a WooCommerce shop and the WooCommerce catalog connection is enabled on your account. It is what lets OptiMonk read your products, so features like the product recommender have something to show.

1. Click the **Login** button in the step, then enter your WordPress username and password. WooCommerce generates the keys and sends them to OptiMonk for you.
2. If you cannot log in to your store that way, enter the keys by hand. In WordPress go to **WooCommerce → Settings → Advanced → REST API**, create a new key with read and write permissions, then paste the generated values into **Consumer Key** and **Consumer Secret** in OptiMonk and click **Save**.

When it works, the step says *Connected — we can read your WooCommerce catalog.* You can drop the connection any time with **Revoke**; OptiMonk then warns you that *If you revoke it, we cannot update your product catalog.*

A few messages you may see instead of the one-click button:

- *We have not seen WooCommerce on {domain} yet.* — finish the steps above and run the check; the one-click connection appears once we detect it. You can still enter the keys by hand.
- *This domain is already connected to {shopType} on your OptiMonk account.* — disconnect that shop first, because connecting WooCommerce here would replace it.

---

## Check that the code is running

At the bottom of the guide there is a **Check now** button. It loads your site once and looks for the OptiMonk code — you don't have to wait for real visitors.

- *The OptiMonk code is live on {domain}.* — you're done.
- *We looked at {domain} and could not find the OptiMonk code yet.* — make sure you saved your changes and that the page is publicly reachable, then **Check again**. On WordPress this is nearly always the cache: purge it and check once more.
- *An OptiMonk code is on {domain}, but it belongs to a different account.* — the site still carries an older installation; replace the ID with the one from step 2.

After a successful check, the domain row in **Settings → Domains** shows **Code inserted**, plus the platform and how it was installed.

If the row later says *no recent traffic*, the code is still installed — nobody has loaded a page from that domain in the last 24 hours.

---

## Can't do this yourself?

Inside the guide, open **Do you need help?** and choose **Send the instructions to my developer**. Fill in their name and email address, edit the message if you want, and click **Send the instructions** — they receive the snippet and what to do with it, without needing an OptiMonk login.
