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

# Magento integration

> Set up the Magento Cometly integration with webhooks so each store purchase reaches Cometly and is matched to the ad that produced it.

The Magento Cometly integration runs through Cometly webhooks: your Magento store sends each order to a webhook URL, and Cometly records it as a purchase event. An event is an action Cometly tracks, such as a purchase or an add to cart. Add to cart and initiate checkout events are tracked separately, through the Cometly pixel (the tracking script on your store).

Once your orders reach Cometly, it matches each purchase to the visitor who placed it and to the ad or channel that brought them. That lets you see which ads produce sales and revenue in your store, not only clicks.

## Before you start

* The Cometly pixel must be installed on your Magento store, including the checkout. See [Install the Cometly pixel](https://docs.cometly.com/getting-started/install-pixel.md).

## Send events from Magento to Cometly

### Purchase events

* Use [Cometly webhooks](#set-up-cometly-webhooks) to send purchase event data directly from Magento.
* In the webhook request, send fields such as **first name**, **last name**, **email** and **order amount** to Cometly. The Cometly pixel on your store automatically captures the email field on the order checkout, and Cometly uses that email to attribute the purchase to the visitor's journey, so you can see the source of the purchase.

### Add to cart and initiate checkout events

Follow the [Add to Cart and Initiate Checkout guide](https://docs.cometly.com/guides/events/add-to-cart-and-initiate-checkout.md) to set these up as browser events tracked through the Cometly pixel.

## Set up Cometly webhooks

See the [Cometly webhooks guide](https://docs.cometly.com/integrations/webhooks.md) for detailed instructions on:

* Creating your webhook in Cometly.
* Selecting the event for the webhook, or creating a new one.
* Mapping the webhook data to the matching fields in Cometly.
* Setting up filters so that only the data you want is tracked.

## Check it worked

In [Events Manager](https://app.cometly.com/space/events-manager), your webhook event shows a switch that is turned on in the **Status** column. Place a new order in your Magento store, then open the **Events Log** tab: the purchase appears there within 60 seconds, with **SUCCESS** in the **Details** column.

## Frequently asked questions

### Does Cometly have a built-in Magento integration?

No. Magento connects to Cometly through webhooks, so your store sends its order data to a webhook URL that you create in Cometly. The [Cometly webhooks guide](https://docs.cometly.com/integrations/webhooks.md) covers the setup from the first click to activation.

### Which fields does my Magento webhook need to send to Cometly?

**Email** and **Event Time** are the two required fields in the webhook mapping. If your order data has no event time, choose **The time we receive the event** for **Event Time**. Send the first name, last name and order amount as well, so the contact and the revenue are complete in Cometly.

### How long does it take for a Magento purchase to show up in Cometly?

The purchase shows in the Events Log within 60 seconds of being sent. It can take up to 15 minutes to appear in the reporting areas, such as the Report Builder or Ads Manager.

## Next steps

* [Send event data to Cometly with webhooks](https://docs.cometly.com/integrations/webhooks.md)
* [Set up Add to Cart and Initiate Checkout events](https://docs.cometly.com/guides/events/add-to-cart-and-initiate-checkout.md)
* [Use the Events Log to check incoming events](https://docs.cometly.com/support/troubleshooting/general/event-log.md)
* [Learn how events work in Cometly](https://docs.cometly.com/guides/events/how-events-work.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.