> ## Documentation Index
> Fetch the complete documentation index at: https://help.revenuehero.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Scheduler script blocked by optimization plugins

> Exclude the RevenueHero scheduler script from WordPress minification, deferring, and delayed execution.

WordPress performance plugins speed up a site by rewriting and delaying its JavaScript. The RevenueHero scheduler script gets caught in that treatment, and it needs to load directly from the CDN and mount early, not after a rewrite or a delay.

## Why this happens

On WordPress sites running WP Rocket, the **File Optimization** module can modify the RevenueHero scheduler script in two ways:

* **JavaScript Minification** rewrites the script into a local cached and minified bundle at `wp-content/cache/min/1/scheduler.min.js` instead of loading it directly from the RevenueHero CDN.
* **Deferring or delaying execution** pushes execution until after page load or the visitor's first interaction, and adds attributes such as `data-rocket-defer`, `defer`, and `data-rocket-status="executed"` to the tag in place of the original ones.

Either one on its own can stop the scheduler initializing correctly. The fix is to exclude the script from both, then place it where the form it targets already exists.

## Exclude the script from WP Rocket

Go to **WP Rocket → File Optimization** and add `revenuehero.io` to the **Excluded JavaScript Files** field under each of these three options:

1. **JavaScript Minification**
2. **Load JavaScript deferred**
3. **Delay JavaScript Execution**

Click **Save Changes**, clear the WP Rocket cache, then reload the page.

<Frame caption="The Excluded JavaScript Files field under Load JavaScript deferred. Add revenuehero.io here, one per line.">
  <img src="https://mintcdn.com/revenuehero/TAE1224DOd8GIQh6/images/image-wp-rocket-exclusion-2.png?fit=max&auto=format&n=TAE1224DOd8GIQh6&q=85&s=dc312f5d21b8c1914bfa96fd1f14f0c0" alt="WP Rocket Excluded JavaScript Files field under Load JavaScript deferred" width="1299" height="513" data-path="images/image-wp-rocket-exclusion-2.png" />
</Frame>

<Warning>
  All three fields need the value. Excluding the script from one does not exclude it from the others, so the script is still either rewritten or held back.
</Warning>

## Place the script in the footer

Add the script in the footer, just before the closing `</body>` tag, not in the header. This can be done via the theme's `footer.php`, or a header and footer plugin such as **WPCode** or **Insert Headers and Footers**.

The second script tag calls `hero.schedule()` against a form on the page, for example a HubSpot form, by its ID. If this runs before that form has rendered, such as from the `<head>` or too early in the body, it might fail to find the form. Footer placement guarantees the form already exists in the DOM.

## Other optimization plugins

The same principle applies if the site runs a different caching or optimization plugin instead of, or alongside, WP Rocket. Exclude the script from minification, from deferred or delayed execution, and from lazy loading, using the same `revenuehero.io` value:

### **LiteSpeed Cache**

Go to **Page Optimization → JS Settings** and add the RevenueHero script domain to both the general **JS Excludes** field and the **Deferred/Delayed Excludes** field.

### **Autoptimize**

Go to **JS → Options** and add the script URL and a matching `revenuehero` keyword to the **JavaScript Exclude List**, so it is skipped during aggregation and minification.

| Plugin                       | Where to add the exclusion                                                                                                                                 |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **WP Fastest Cache**         | **Settings → Exclude JS**, add `revenuehero.io` under "Exclude Minify JS"                                                                                  |
| **Perfmatters**              | **Settings → Scripts** (delay JS), add `revenuehero.io` to the exclusion list                                                                              |
| **Cloudflare Rocket Loader** | If enabled at the Cloudflare or CDN level, add `revenuehero.io` to the Rocket Loader ignore list, or add `data-cfasync="false"` directly on the script tag |
| **SiteGround Optimizer**     | Check the JavaScript optimization or "Exclude files from JS combine" section and add the same domain                                                       |

<Note>
  Other host level optimizers vary in what they call this. Look for a JavaScript optimization or JS combine section and add the same domain.
</Note>

## Verifying the fix

After saving the exclusions, confirm the fix on a live page load, not a cached one:

1. Clear the WP Rocket cache, and the CDN cache if applicable.
2. Reload the page in an incognito or private window.
3. In DevTools, find the scheduler tag and confirm it has a real `src` attribute reading `https://assets.revenuehero.io/scheduler.min.js`, not a `/wp-content/cache/min/1/...` path.
4. Confirm the tag carries no `data-rocket-*` attributes and no `type="text/rocketlazyloadscript"`.
5. Confirm the scheduler fires on initial page load, not only after a scroll or a click.

## Before you go live

* [ ] `revenuehero.io` added to **JavaScript Minification → Excluded JavaScript Files**
* [ ] `revenuehero.io` added to **Load JavaScript deferred → Excluded JavaScript Files**
* [ ] `revenuehero.io` added to **Delay JavaScript Execution → Excluded JavaScript Files**
* [ ] Script placed in the footer, just before `</body>`
* [ ] Cache cleared, including the CDN cache
* [ ] Verified in an incognito window: direct CDN `src`, no defer attributes, fires on page load

<CardGroup cols={2}>
  <Card title="Install the RevenueHero script" icon="code" iconType="solid" href="/Inbound-router-installation">
    Every way to invoke the scheduler on your site, from form listeners to programmatic triggers.
  </Card>

  <Card title="Map your web form" icon="table-columns" iconType="solid" href="/routers/inbound/mapping-your-form">
    Use each field in your form as a routing condition.
  </Card>
</CardGroup>
