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

# Delayed JavaScript execution or lazy loading

> Fix the delayed JavaScript execution or lazy loading error on the Cometly pixel, so the pixel loads with the page and stops missing tracking data.

You see the "Delayed javascript execution or lazy loading" error when a plugin or a code setting on your website delays the loading of the Cometly pixel. The pixel is the script that tracks where your website visitors come from and captures opt-in data from your forms.

This issue stops Cometly from tracking accurately and results in missed data. The usual cause is a speed or caching tool that holds scripts back to make pages load faster, so the Cometly pixel's delayed JavaScript execution is something you fix in that tool's settings, not in Cometly.

## How to fix delayed JavaScript execution on the Cometly pixel

1. **WordPress sites:** you may have a plugin installed that delays JavaScript execution. The most common one is WP Rocket. To turn off its **Delay JavaScript execution** setting, see [WordPress pixel installation](https://docs.cometly.com/integrations/pixel/wordpress.md).

2. **Custom sites:** manually remove the code that delays the Cometly pixel's JavaScript.

> [!NOTE]
>
> If you pinned your site to a script version (**Setup** > **Install the Cometly pixel** > **Script version**), the pixel tag must stay exactly as Cometly shows it. An optimizer that rewrites the tag (an optimizer plugin, Cloudflare Rocket Loader or Auto Minify, a tag manager) stops the browser from running it. Paste the snippet again and exclude it from optimization.

## Confirm the pixel loads

After the change, check the pixel again in Cometly under **Setup** > **Install the Cometly pixel** > **Verify your pixel**. Click **Verify** next to your domain: it should show **Pixel detected**. See [Install and verify the Cometly pixel](https://docs.cometly.com/getting-started/install-pixel.md).

If it shows **Pixel not detected**, clear your website's cache, check the settings above again, then click **Retry**.

## Frequently asked questions

### Which WP Rocket settings stop the Cometly pixel from loading?

Three options in the **JavaScript Files** section of WP Rocket's **File Optimization** tab: **Combine JavaScript files**, **Load JavaScript deferred** and **Delay JavaScript execution**. Make sure all three are unchecked, click **Save Changes**, then clear your cache. [WordPress pixel installation](https://docs.cometly.com/integrations/pixel/wordpress.md) shows where to find them.

### Do other caching or performance plugins delay the Cometly pixel?

They can. Any plugin that defers or lazy-loads JavaScript can interfere with the pixel, so turn those options off. Check the plugin's documentation for settings similar to the WP Rocket ones.

### Does installing the Cometly pixel through Google Tag Manager delay it?

It can. The pixel works when it is installed through Google Tag Manager, but you may lose attribution data because of loading delays and privacy blockers. Installing it directly in the `<head>` section of your website is recommended. See [Google Tag Manager pixel installation](https://docs.cometly.com/integrations/pixel/google-tag-manager.md).

## Next steps

* [Install and verify the Cometly pixel](https://docs.cometly.com/getting-started/install-pixel.md)
* [Install the Cometly pixel on WordPress](https://docs.cometly.com/integrations/pixel/wordpress.md)
* [Check your pages with the Cometly Pixel Helper](https://docs.cometly.com/guides/tracking/pixel-helper.md)
* [Fix the base code not detected error](https://docs.cometly.com/support/troubleshooting/pixel/base-code-not-detected.md)
* [Use Cometly with a Content Security Policy](https://docs.cometly.com/support/troubleshooting/pixel/content-security-policy.md)

Still have questions or need a hand? We're happy to help. Reach our team at [support@cometly.com](mailto:support@cometly.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.