> ## 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.

# WooCommerce integration

> Set up the WooCommerce Cometly integration: install the plugin to add the pixel to your store and see which ad produced each purchase.

The WooCommerce Cometly integration is a WordPress plugin that connects your WooCommerce store to Cometly. It adds the Cometly pixel (the tracking script that records visits to your site) and sends your store's orders to Cometly as events (the actions Cometly records, such as a purchase).

With visits and orders in one place, Cometly can tie each purchase back to the ad or channel that brought the customer in. You see which campaigns produce sales and revenue, not only clicks.

Once installed, the plugin:

* Adds the Cometly pixel to the `<head>` of your WooCommerce site.
* Fires **Add to Cart** and **Initiate Checkout** events.
* Creates a webhook in WooCommerce that sends a **Purchase** event to Cometly whenever an order is completed.

## Before you install

> [!WARNING]
>
> Read these points before you install the Cometly WooCommerce plugin.

1. **Do not install the pixel by hand.** Do not paste the Cometly pixel into your WooCommerce store yourself. The plugin adds it for you.
2. **The plugin tracks three events.** It tracks **Add to Cart**, **Initiate Checkout** and **Purchase**.
3. **Pages outside WordPress need the pixel installed by hand.** The plugin does not add the pixel to landing pages that are not part of your WordPress site. Install the pixel on those pages yourself. See [Install the Cometly pixel](https://docs.cometly.com/getting-started/install-pixel.md).
4. **The plugin is specific to one space.** Each Cometly space has its own WooCommerce plugin, which carries that space's pixel and purchase webhook. If you have more than one store or space, download the plugin from the space that belongs to each store.

## Step 1: Download and install the Cometly WooCommerce plugin

**1. Open the WooCommerce integration**

In Cometly, go to [**Integrations**](https://app.cometly.com/integrations), find the **WooCommerce** card (category **Ecommerce**) and click **Connect**.

![Apps & Integrations page in Cometly with the Ecommerce category selected and an arrow pointing to the Connect button on the WooCommerce card](https://mintcdn.com/cometly/alvP4_0ekdK-CBm_/images/integrations/platforms/woocommerce/01.webp?fit=max\&auto=format\&n=alvP4_0ekdK-CBm_\&q=85\&s=1d3a2e72f78281b8a9987c71a28d02fa)

You can also start from **Events Manager**: click **Create Event**, choose **WooCommerce** under **App / Integration**, then click **Integrate**.

**2. Activate WooCommerce**

Click **Activate WooCommerce**.

**3. Download the plugin**

Under **Download the WordPress plugin**, click **Download plugin**. Your browser saves a file named `cometly-woocommerce-tracking-plugin.zip`.

> [!WARNING]
>
> 1. The plugin is **specific to this Cometly space**. If you have more than one store, make sure you download the plugin from the correct space.
> 2. If you set up Cometly before with an older plugin version, or pasted the Cometly pixel into your store by hand, **remove it before you add the plugin**.

**4. Open Plugins in WordPress**

In the WordPress admin of your WooCommerce store, go to **Plugins**.

![WordPress admin menu with an arrow pointing to Plugins](https://mintcdn.com/cometly/alvP4_0ekdK-CBm_/images/integrations/platforms/woocommerce/05.webp?fit=max\&auto=format\&n=alvP4_0ekdK-CBm_\&q=85\&s=f34e2da6ffb791101c98e961ee0a0cd7)

**5. Add a new plugin**

Click **Add New**.

![WordPress Plugins page with an arrow pointing to the Add New button](https://mintcdn.com/cometly/alvP4_0ekdK-CBm_/images/integrations/platforms/woocommerce/06.webp?fit=max\&auto=format\&n=alvP4_0ekdK-CBm_\&q=85\&s=92b9a92dbbbb29295005f6cd11f40308)

**6. Upload and activate the plugin**

Upload the Cometly WooCommerce plugin `.zip` file, then activate the plugin. The plugin creates its purchase webhook when it is activated, and WooCommerce must be installed and active first.

![WordPress Install plugin screen with a drop area for the plugin zip file](https://mintcdn.com/cometly/alvP4_0ekdK-CBm_/images/integrations/platforms/woocommerce/07.webp?fit=max\&auto=format\&n=alvP4_0ekdK-CBm_\&q=85\&s=c06fe72bdeaf445241f5dc2c53a1221d)

**7. Map the WooCommerce event**

Back on the WooCommerce integration page in Cometly, **Map WooCommerce events to Cometly** lists the WooCommerce **Purchase** event next to a Cometly event (**Purchase** by default). To record WooCommerce purchases as a different Cometly event, choose it, then click **Save**.

> [!NOTE]
>
> The plugin installs the pixel for you, but the **Install the Cometly pixel** step in **Setup** is only marked complete once a domain is verified. Add your store's domain under **Add domains** in that step, then click **Verify** under **Verify your pixel**.

## Step 2: Clear the cache on your WooCommerce store

WordPress sites often serve cached pages. Clear your cache after you install the plugin so the pixel loads on every page.

> [!WARNING]
>
> If you use a site performance plugin, make sure it does not delay JavaScript loading.

### WP Rocket instructions

If you use WP Rocket, check that specific settings are **unchecked**.

In your WP Rocket settings, go to **FILE OPTIMIZATION**.

![WP Rocket settings menu with an arrow pointing to File Optimization](https://mintcdn.com/cometly/alvP4_0ekdK-CBm_/images/integrations/platforms/woocommerce/08.webp?fit=max\&auto=format\&n=alvP4_0ekdK-CBm_\&q=85\&s=45a36013ea822618003286200b4ded07)

Scroll down to **JavaScript Files** and make sure all of the following checkboxes are **unchecked**. If they are checked, the Cometly pixel may not load properly.

## Check it worked

Place a test order on your store and pay for it. The order appears as a **Purchase** event in **Events Manager**, on the **Events Log** tab. On the WooCommerce integration page in Cometly, the first card reads **WooCommerce activated**.

## Troubleshooting for WooCommerce stores

### Purchases have stopped sending to Cometly

If purchases have stopped sending to Cometly from your WooCommerce store, the WooCommerce webhook may no longer be set to **Active**. See [Make sure your WooCommerce webhook is active](https://docs.cometly.com/support/troubleshooting/events/woocommerce-webhook-active.md) to reactivate it.

### The pixel is not loading or verifying in Cometly

If the Cometly pixel does not load or verify after you install the plugin, check for site performance plugins that defer or delay JavaScript. They can stop the pixel from loading, which leads to inaccurate or missed attribution data. Make sure JavaScript loading is not delayed.

### The plugin is not compatible with your store

In the **rare** case that the Cometly WooCommerce plugin is not compatible with your store (for example, it causes issues on a custom-built store), you cannot use the plugin and need to set up tracking by hand:

1. Uninstall the Cometly plugin.
2. Install the Cometly pixel in the `<head>` of your WooCommerce store.
   1. In Cometly, go to **Setup** and open the **Install the Cometly pixel** step to copy your pixel code. See [Install the Cometly pixel](https://docs.cometly.com/getting-started/install-pixel.md).
   2. You can use Google Tag Manager to install the pixel if needed.
3. Use Cometly webhooks and add the webhook to your WooCommerce store by hand.
   1. In the WordPress admin menu, hover over **WooCommerce** and click **Settings**.
   2. Click the **Advanced** tab at the top of the page.
   3. In the sub-menu of the Advanced settings, click **Webhooks**.
   4. Generate a webhook URL in Cometly. Follow the [Cometly webhooks guide](https://docs.cometly.com/integrations/webhooks.md) for this step.
   5. Add the Cometly webhook in your WooCommerce store:
      1. Webhook name: Cometly
      2. Webhook topic: order.updated
      3. Set the webhook status to **Active**
      4. Click **Save**
4. Use Google Tag Manager to fire the Add to Cart and Initiate Checkout events when a button is clicked. Follow the [guide to setting up Add to Cart and Initiate Checkout events](https://docs.cometly.com/guides/events/add-to-cart-and-initiate-checkout.md).

   > [!NOTE]
   >
   > The Cometly pixel does not need to be in Google Tag Manager for these events to fire. They still fire properly if the pixel is hard coded on your WooCommerce store.

## Frequently asked questions

### Why is a WooCommerce order missing from Cometly?

Cometly records a WooCommerce purchase once the order is paid, so an order that is still unpaid does not appear yet. If a paid order is missing, go to **Events Manager**, open the **Events Log** tab and look for an error on that order. Then check that the webhook is still active, as described in [Make sure your WooCommerce webhook is active](https://docs.cometly.com/support/troubleshooting/events/woocommerce-webhook-active.md).

### Does Cometly convert WooCommerce orders placed in another currency?

Yes. When an order's currency is different from the currency of your Cometly space, Cometly converts the order total to the space's currency before it records the purchase.

### Will Cometly count the same WooCommerce order twice?

No. WooCommerce notifies Cometly each time an order is updated, and the plugin sends the WooCommerce order key as the Order ID with every purchase. Cometly ignores a repeat of the same event with the same Order ID. See [how Order ID works](https://docs.cometly.com/guides/tracking/order-id.md).

## Next steps

* [Send purchases to Meta with the Meta Conversion API](https://docs.cometly.com/guides/conversion-api/meta.md)
* [Configure the Google Conversion API](https://docs.cometly.com/guides/conversion-api/google.md)
* [Install the Cometly pixel on pages outside WordPress](https://docs.cometly.com/getting-started/install-pixel.md)
* [Set up Add to Cart and Initiate Checkout events by hand](https://docs.cometly.com/guides/events/add-to-cart-and-initiate-checkout.md)
* [Learn how webhook mapping, filters and activation work](https://docs.cometly.com/integrations/webhooks.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.